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?, #flow_passes_parse, #flow_passes_preconditions, #get_args_used, #init, #initialize, #option_help_string, #run, #show_help, #show_help_option
Constructor Details
This class inherits a constructor from Command
Instance Method Details
#add_options ⇒ Object
9
10
11
12
|
# File 'lib/vzcdn.rb', line 9
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
23
24
25
26
|
# File 'lib/vzcdn.rb', line 23
def create_args
add_cmd(Zone, "zone", "dns zone command")
add_cmd(ConfigCommand, "config", "configuration control")
end
|
#create_flows ⇒ Object
28
29
30
31
|
# File 'lib/vzcdn.rb', line 28
def create_flows
add_flow_from_usage("zone")
add_flow_from_usage("config")
end
|
#execute(args, subargs) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/vzcdn.rb', line 33
def execute(args, subargs)
command = args["command"]
if command
command.run(subargs)
else
puts "command is nil"
end
end
|
#print_version ⇒ Object
14
15
16
17
|
# File 'lib/vzcdn.rb', line 14
def print_version
puts "vzcdn Version:" + Vzcdn::VERSION
exit
end
|
#set_debug ⇒ Object
19
20
21
|
# File 'lib/vzcdn.rb', line 19
def set_debug
$debug += 1
end
|