Class: Bullematic::CLI

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

Class Method Summary collapse

Class Method Details

.run(argv) ⇒ Integer

RBS:

  • argv: Array[String]

  • return: Integer

Parameters:

  • argv (Array[String])

Returns:

  • (Integer)


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

def run(argv)
  command = argv.shift
  case command
  when "record" then record(command_args(argv))
  when "plan" then apply(dry_run: true)
  when "apply" then apply(dry_run: false)
  when "verify" then verify(command_args(argv))
  when "fix" then fix(argv)
  when "doctor" then doctor
  else
    warn "Usage: bullematic record -- COMMAND | plan | apply | verify [-- COMMAND] | fix [--verify] -- COMMAND | doctor"
    1
  end
rescue Error, SystemCallError, JSON::ParserError => error
  warn "bullematic: #{error.message}"
  1
end