Class: Smith::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



8
9
10
# File 'lib/smith/cli.rb', line 8

def initialize(argv)
  @argv = argv.dup
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/smith/cli.rb', line 12

def run
  command = @argv.shift || "doctor"
  case command
  when "doctor"  then run_doctor
  when "install" then run_install
  when "version" then run_version
  when "--help", "-h" then run_help
  else
    warn "Unknown command: #{command}"
    warn usage
    1
  end
end