Class: Binpacker::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI

Returns a new instance of CLI.

Parameters:

  • (Object)


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

def initialize(args)
  @args = args.dup
  @command = nil
  @profile = nil
  @passthrough = []
  @quiet = false
  @incremental = false
  @report_path = nil
  @skill_list = false
  @skill_path = false
  @skill_describe = false
  @skill_name = nil
  parse!
end

Class Method Details

.start(args) ⇒ nil

Parameters:

  • (Object)

Returns:

  • (nil)


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

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

Instance Method Details

#runnil

Returns:

  • (nil)


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/binpacker/cli.rb', line 27

def run
  case @command
  when "calibrate"
    cmd_calibrate
  when "run"
    cmd_run
  when "init"
    cmd_init
  when "skill"
    cmd_skill
  when "describe"
    cmd_describe
  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