Class: Vcloud::EdgeGateway::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/vcloud/edge_gateway/cli.rb

Constant Summary collapse

ANSI_RESET =
"\033[0m"
ANSI_RED =
"\033[31m"
ANSI_GREEN =
"\033[32m"

Instance Method Summary collapse

Constructor Details

#initialize(argv_array) ⇒ Cli

Returns a new instance of Cli.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vcloud/edge_gateway/cli.rb', line 10

def initialize(argv_array)
  @usage_text = nil
  @config_file = nil
  @options = {
    :template_vars => nil,
    :colour => STDOUT.tty?,
    :dry_run => nil,
  }

  parse(argv_array)
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/vcloud/edge_gateway/cli.rb', line 22

def run
  config_args = [@config_file]
  if @options[:template_vars]
    config_args << @options[:template_vars]
  end

  update_args = []
  if @options[:dry_run]
    update_args << @options[:dry_run]
  end

  conf = Vcloud::EdgeGateway::Configure.new(*config_args)
  diff = conf.update(*update_args)
  puts render_diff(diff)
end