Class: Pennyworth::CLI::Shell

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

Overview

The main Command Line Interface (CLI) object.

Constant Summary collapse

ACTIONS =
{
  config: Actions::Config.new,
  encodings: Actions::Encodings.new,
  git_hub: Actions::GitHub.new,
  http_statuses: Actions::HTTPStatuses.new,
  ruby_gems: Actions::RubyGems.new,
  system_errors: Actions::System::Errors.new,
  system_signals: Actions::System::Signals.new,
  text: Actions::Text.new
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(parser: Parsers::Assembler.new, actions: ACTIONS, container: Container) ⇒ Shell

Returns a new instance of Shell.



18
19
20
21
22
# File 'lib/pennyworth/cli/shell.rb', line 18

def initialize parser: Parsers::Assembler.new, actions: ACTIONS, container: Container
  @parser = parser
  @actions = actions
  @container = container
end

Instance Method Details

#call(arguments = []) ⇒ Object



24
25
26
27
28
# File 'lib/pennyworth/cli/shell.rb', line 24

def call arguments = []
  perform parser.call(arguments)
rescue OptionParser::ParseError, KeyError => error
  logger.error error.message
end