rvc 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
data/bin/rvc CHANGED
@@ -34,8 +34,11 @@ include RVC::Util
34
34
  Thread.abort_on_exception = true
35
35
 
36
36
  CMD = Module.new
37
+ RVC::VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
37
38
 
38
39
  $opts = Trollop.options do
40
+ version RVC::VERSION
41
+
39
42
  banner <<-EOS
40
43
  Ruby vSphere Console.
41
44
 
@@ -22,8 +22,14 @@ require 'readline'
22
22
  require 'rvc/ttl_cache'
23
23
 
24
24
  begin
25
- require 'rvc/readline-ffi'
26
- rescue Exception
25
+ require 'ffi'
26
+ begin
27
+ require 'rvc/readline-ffi'
28
+ rescue Exception
29
+ $stderr.puts "Error loading readline-ffi: #{$!.message}. Tab completion will be limited."
30
+ end
31
+ rescue LoadError
32
+ $stderr.puts "Install the \"ffi\" gem for better tab completion."
27
33
  end
28
34
 
29
35
  module RVC
@@ -39,11 +45,6 @@ module Completion
39
45
  end
40
46
 
41
47
  def self.install
42
- unless Readline.respond_to? :line_buffer and
43
- Readline.respond_to? :char_is_quoted=
44
- $stderr.puts "Install the \"ffi\" gem for better tab completion."
45
- end
46
-
47
48
  if Readline.respond_to? :char_is_quoted=
48
49
  Readline.completer_word_break_characters = " \t\n\"'"
49
50
  Readline.completer_quote_characters = "\"\\"
@@ -620,6 +620,18 @@ def deltaize_disks vm
620
620
  end
621
621
  end
622
622
 
623
+
624
+ opts :annotate do
625
+ summary "Change a VM's annotation"
626
+ arg :vm, nil, :lookup => VIM::VirtualMachine
627
+ arg :annotation, nil
628
+ end
629
+
630
+ def annotate vm, str
631
+ vm.ReconfigVM_Task(:spec => { :annotation => str }).wait_for_completion
632
+ end
633
+
634
+
623
635
  def find_vmx_files ds
624
636
  datastorePath = "[#{ds.name}] /"
625
637
  searchSpec = {
@@ -40,6 +40,7 @@ end
40
40
 
41
41
  opts :view do
42
42
  summary "Spawn a VMRC"
43
+ text "The VMware Remote Console allows you to interact with a VM's virtual mouse, keyboard, and screen."
43
44
  arg :vm, nil, :lookup => VIM::VirtualMachine, :multi => true
44
45
  end
45
46
 
@@ -66,8 +66,13 @@ class OptionParser < Trollop::Parser
66
66
  fail "Multi argument must be the last one" if @seen_multi
67
67
  fail "Can't have required argument after optional ones" if spec[:required] and @seen_not_required
68
68
  fail "lookup and lookup_parent are mutually exclusive" if spec[:lookup] and spec[:lookup_parent]
69
- @applicable << spec[:lookup] if spec[:lookup]
70
- @applicable << spec[:lookup_parent] if spec[:lookup_parent]
69
+ [:lookup, :lookup_parent].each do |sym|
70
+ if spec[sym].is_a? Enumerable
71
+ spec[sym].each { |x| @applicable << x }
72
+ elsif spec[sym]
73
+ @applicable << spec[sym]
74
+ end
75
+ end
71
76
  @args << [name,spec]
72
77
  text " #{name}: " + [description, spec[:lookup], spec[:lookup_parent]].compact.join(' ')
73
78
  end
data/lib/rvc/util.rb CHANGED
@@ -28,7 +28,7 @@ module Util
28
28
  end
29
29
 
30
30
  def lookup_single path
31
- objs = lookup(path, type)
31
+ objs = lookup path
32
32
  err "Not found: #{path.inspect}" if objs.empty?
33
33
  err "More than one match for #{path.inspect}" if objs.size > 1
34
34
  objs.first
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rvc
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.0
5
+ version: 1.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Rich Lane