Class: Vixen::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/vixen/command_line.rb

Defined Under Namespace

Classes: Base, Resume, Snapshot, Start, Status, Stop, Suspend, Vm

Instance Method Summary collapse

Instance Method Details

#executeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vixen/command_line.rb', line 4

def execute

  context = {}

  command = ARGV.shift
  command ||= 'status'

  ARGV.unshift command

  while ! ARGV.empty?
    begin
      command = ARGV.shift
      require "vixen/command_line/#{command}"

      klass = self.class.const_get(command.split('_').map {|s| s.capitalize }.join)
      raise "Couldn't find #{command}" unless klass

      klass.new(context).execute
    rescue LoadError
      puts "Unknown command: #{command}"
    end
  end
end