Class: Rubysmith::CLI::Parsers::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/rubysmith/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(options: {}, client: CLIENT) ⇒ Core

Returns a new instance of Core.



12
13
14
15
# File 'lib/rubysmith/cli/parsers/core.rb', line 12

def initialize options: {}, client: CLIENT
  @options = options
  @client = client
end

Class Method Details

.call(options: {}, client: CLIENT) ⇒ Object



10
# File 'lib/rubysmith/cli/parsers/core.rb', line 10

def self.call(options: {}, client: CLIENT) = new(options: options, client: client).call

Instance Method Details

#call(arguments = []) ⇒ Object



17
18
19
20
21
22
# File 'lib/rubysmith/cli/parsers/core.rb', line 17

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