Class: Hyraft::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/hyraft/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



17
18
19
20
# File 'lib/hyraft/cli.rb', line 17

def initialize(argv)
  @argv = argv
  @command, @app_name = argv
end

Class Method Details

.start(argv) ⇒ Object



13
14
15
# File 'lib/hyraft/cli.rb', line 13

def self.start(argv)
  new(argv).execute
end

Instance Method Details

#executeObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hyraft/cli.rb', line 22

def execute
  case @command
  when "do"
    do_application
  when "version", "-v", "--version"
    puts "Hyraft version #{VERSION}"
  when nil, "help", "-h", "--help"
    show_help
  else
    abort "Unknown command: #{@command}"
  end
end