Class: Leftovers::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(argv: []) ⇒ CLI

Returns a new instance of CLI.



7
8
9
# File 'lib/leftovers/cli.rb', line 7

def initialize(argv: [])
  @argv = argv
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/leftovers/cli.rb', line 11

def run
  parse_options

  runner.run
rescue ::Leftovers::Error => e
  Leftovers.warn("\e[31m#{e.class}: #{e.message}\e[0m\n\n#{e.backtrace.join("\n")}")
  1
rescue ::Leftovers::Exit => e
  e.status # what why?
end