Class: Pennyworth::CLI::Parsers::Core

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

Overview

Handles parsing of Command Line Interface (CLI) core options.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration = Configuration::Loader.call, client: CLIENT) ⇒ Core

Returns a new instance of Core.



15
16
17
18
# File 'lib/pennyworth/cli/parsers/core.rb', line 15

def initialize configuration = Configuration::Loader.call, client: CLIENT
  @configuration = configuration
  @client = client
end

Class Method Details

.callObject



13
# File 'lib/pennyworth/cli/parsers/core.rb', line 13

def self.call(...) = new(...).call

Instance Method Details

#call(arguments = []) ⇒ Object



20
21
22
23
24
25
# File 'lib/pennyworth/cli/parsers/core.rb', line 20

def call arguments = []
  client.banner = "#{Identity::LABEL} - #{Identity::SUMMARY}"
  client.separator "\nUSAGE:\n"
  collate
  arguments.empty? ? arguments : client.parse!(arguments)
end