Class: CloudstackCli::Cli
- Inherits:
-
Base
- Object
- Thor
- Base
- CloudstackCli::Cli
show all
- Includes:
- Thor::Actions
- Defined in:
- lib/cloudstack-cli/cli.rb
Constant Summary
Constants included
from Helper
Helper::ASYNC_STATES
Instance Attribute Summary
Attributes inherited from Base
#config
Instance Method Summary
collapse
Methods inherited from Base
exit_on_failure?
Methods included from Helper
#ask_number, #bootstrap_server, #bootstrap_server_interactive, #create_port_rules, #create_server, #print_job_status, #print_options, #update_job_status, #watch_jobs
Instance Method Details
#command(command, *args) ⇒ Object
48
49
50
51
52
53
54
55
56
|
# File 'lib/cloudstack-cli/cli.rb', line 48
def command(command, *args)
params = {'command' => command}
args.each do |arg|
arg = arg.split('=')
params[arg[0]] = arg[1]
end
data = client.send_request(params)
puts JSON.pretty_generate(data)
end
|
#completion ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/cloudstack-cli/cli.rb', line 35
def completion
shell_script = File.join(
File.dirname(__FILE__), '..', '..',
'completions', "cs.#{options[:shell]}"
)
unless File.file? shell_script
say "Specified cloudstack-cli shell auto-completion rules for #{options[:shell]} not found.", :red
exit 1
end
puts File.read shell_script
end
|
#setup(env = options[:environment]) ⇒ Object
28
29
30
31
|
# File 'lib/cloudstack-cli/cli.rb', line 28
def setup(env = options[:environment])
invoke "environment:add", [env],
:config_file => options[:config_file]
end
|
#version ⇒ Object
21
22
23
24
|
# File 'lib/cloudstack-cli/cli.rb', line 21
def version
say "cloudstack-cli version #{CloudstackCli::VERSION}"
say " (cloudstack_client version #{CloudstackClient::VERSION})"
end
|