Class: Ace::Support::Config::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/support/config/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.start(argv) ⇒ Object



12
13
14
# File 'lib/ace/support/config/cli.rb', line 12

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

Instance Method Details

#run(argv) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ace/support/config/cli.rb', line 16

def run(argv)
  return show_help if argv.empty?

  command = argv.shift

  case command
  when "init"
    run_init(argv)
  when "diff"
    run_diff(argv)
  when "list"
    run_list(argv)
  when "version", "--version"
    show_version
  when "help", "--help", "-h"
    show_help
  else
    puts "Unknown command: #{command}"
    puts ""
    show_help
    exit 1
  end
end