Class: VzcdnApp
Instance Attribute Summary
Attributes inherited from Command
#desc, #name
Instance Method Summary
collapse
Methods inherited from Command
#add_arg, #add_cmd, #add_flow, #add_flow_from_usage, #add_input, #add_option, #command_name?, #get_args_used, #init, #initialize, #run, #show_help, #show_help_option
Constructor Details
This class inherits a constructor from Command
Instance Method Details
#add_options ⇒ Object
11
12
13
14
|
# File 'lib/vzcdn.rb', line 11
def add_options
add_option({ short_name: 'v', long_name: 'version', method: :print_version, takes_value: false})
add_option({ short_name: 'd', long_name: 'debug', method: :set_debug, takes_value: false})
end
|
#create_args ⇒ Object
25
26
27
28
|
# File 'lib/vzcdn.rb', line 25
def create_args
add_cmd(Zone, "zone", "dns zone command")
add_cmd(ConfigCommand, "config", "configuration control")
end
|
#create_flows ⇒ Object
30
31
32
33
|
# File 'lib/vzcdn.rb', line 30
def create_flows
add_flow_from_usage("zone")
add_flow_from_usage("config")
end
|
#execute(args, subargs) ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/vzcdn.rb', line 35
def execute(args, subargs)
command = args["command"]
if command
command.run(subargs)
else
puts "command is nil"
end
end
|
#print_version ⇒ Object
16
17
18
19
|
# File 'lib/vzcdn.rb', line 16
def print_version
puts "vzcdn Version:" + Vzcdn::VERSION
exit
end
|
#set_debug ⇒ Object
21
22
23
|
# File 'lib/vzcdn.rb', line 21
def set_debug
$debug = true
end
|