Class: Hanamismith::CLI::Shell

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

Overview

The main Command Line Interface (CLI) object.

Instance Method Summary collapse

Constructor Details

#initialize(parser: Parser.new, **dependencies) ⇒ Shell

Returns a new instance of Shell.



11
12
13
14
# File 'lib/hanamismith/cli/shell.rb', line 11

def initialize parser: Parser.new, **dependencies
  super(**dependencies)
  @parser = parser
end

Instance Method Details

#call(arguments = Core::EMPTY_ARRAY) ⇒ Object



16
17
18
19
20
# File 'lib/hanamismith/cli/shell.rb', line 16

def call arguments = Core::EMPTY_ARRAY
  act_on parser.call(arguments)
rescue OptionParser::ParseError => error
  logger.error { error.message }
end