Class: Fission::Command::Start
Instance Attribute Summary
#args, #options
Instance Method Summary
collapse
#command_name, help, #ui
#incorrect_arguments, #parse_arguments
Constructor Details
#initialize(args = []) ⇒ Start
Returns a new instance of Start.
5
6
7
8
|
# File 'lib/fission/command/start.rb', line 5
def initialize(args=[])
super
@options.headless = false
end
|
Instance Method Details
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/fission/command/start.rb', line 10
def execute
super
incorrect_arguments if @args.empty?
vm = VM.new @args.first
output "Starting '#{vm.name}'"
start_args = {}
start_args[:headless] = true if @options.headless
response = vm.start start_args
if response.successful?
output "VM '#{vm.name}' started"
else
output_and_exit "There was a problem starting the VM. The error was:\n#{response.message}", response.code
end
end
|
#option_parser ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/fission/command/start.rb', line 30
def option_parser
optparse = OptionParser.new do |opts|
opts.banner = "Usage: fission start TARGET_VM [OPTIONS]"
opts.separator ''
opts.separator 'Starts TARGET_VM.'
opts.separator ''
opts.separator 'OPTIONS:'
opts.on '--headless', 'Start the VM in headless mode (i.e. no Fusion GUI console)' do
@options.headless = true
end
end
optparse
end
|
45
46
47
|
# File 'lib/fission/command/start.rb', line 45
def summary
'Start a VM'
end
|