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 +1 -1
- data/bin/rvc +3 -0
- data/lib/rvc/completion.rb +8 -7
- data/lib/rvc/modules/vm.rb +12 -0
- data/lib/rvc/modules/vmrc.rb +1 -0
- data/lib/rvc/option_parser.rb +7 -2
- data/lib/rvc/util.rb +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
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
|
|
data/lib/rvc/completion.rb
CHANGED
@@ -22,8 +22,14 @@ require 'readline'
|
|
22
22
|
require 'rvc/ttl_cache'
|
23
23
|
|
24
24
|
begin
|
25
|
-
require '
|
26
|
-
|
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 = "\"\\"
|
data/lib/rvc/modules/vm.rb
CHANGED
@@ -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 = {
|
data/lib/rvc/modules/vmrc.rb
CHANGED
data/lib/rvc/option_parser.rb
CHANGED
@@ -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
|
-
|
70
|
-
|
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