Class: Binpacker::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI

Returns a new instance of CLI.



12
13
14
15
16
17
18
# File 'lib/binpacker/cli.rb', line 12

def initialize(args)
  @args = args.dup
  @command = nil
  @profile = nil
  @passthrough = []
  parse!
end

Class Method Details

.start(args) ⇒ Object



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

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

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/binpacker/cli.rb', line 20

def run
  case @command
  when "calibrate"
    cmd_calibrate
  when "run"
    cmd_run
  when "--version", "-v"
    puts "binpacker #{Binpacker::VERSION}"
  when "--help", "-h", nil
    print_help
  else
    $stderr.puts "unknown command: #{@command}"
    print_help
    exit 1
  end
end