diff --git a/README.rdoc b/README.rdoc index 884b9c5..f59fa94 100644 --- a/README.rdoc +++ b/README.rdoc @@ -91,6 +91,13 @@ When the working directory is a descendant of a Datacenter object, the mark "~" refers to the Datacenter. For example "~/datastore" is a convenient way to get the datastore folder of the current datacenter. +Loading marks is possible too. A file named ~/.rvc-marks.yaml in the +simple format of: + +vcenter.hostname: { markname: /path/name/, + anothermarkname: /a/longer/path/name } +another.vcenter.host: { ... } + === Aggregate marks More than one object can be given to the "mark" command. The resulting mark can diff --git a/bin/rvc b/bin/rvc index 2ccfeb9..65fcef1 100644 --- a/bin/rvc +++ b/bin/rvc @@ -130,6 +130,18 @@ if $interactive $stderr.puts "VMRC is not installed. You will be unable to view virtual machine consoles. Use the vmrc.install command to install it." unless CMD.vmrc.find_vmrc $stderr.puts "Use the 'connect' command to connect to an ESX or VC server." if $shell.connections.empty? CMD.basic.ls RVC::Util.lookup_single('.') + + # Load the marks YAML file, and see if we have one defined for this host. Apply those marks if we do. + marks_fn = "#{ENV['HOME']}/.rvc-marks.yaml" + if File.exists? marks_fn + marks = YAML.load_file marks_fn + connected_hostname = $shell.connections.first.first + if marks[connected_hostname] + marks[connected_hostname].each do |mark,path| + $shell.session.set_mark mark, [ RVC::Util.lookup_single( path ) ] + end + end + end end if $opts[:script]