class Fission::Command::Start

Public Class Methods

new(args=[]) click to toggle source
Calls superclass method Fission::Command.new
# File lib/fission/command/start.rb, line 5
def initialize(args=[])
  super
  @options.headless = false
end

Public Instance Methods

execute() click to toggle source
Calls superclass method Fission::Command#execute
# 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() click to toggle source
# 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
summary() click to toggle source
# File lib/fission/command/start.rb, line 45
def summary
  'Start a VM'
end