Class: Rubysmith::CLI::Shell

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

Overview

The main Command Line Interface (CLI) object.

Constant Summary collapse

PROCESSORS =
{
  config: Processors::Config.new,
  build_minimum: Processors::Build.with_minimum,
  build_maximum: Processors::Build.new
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(parser: Parsers::Assembler.new, processors: PROCESSORS) ⇒ Shell

Returns a new instance of Shell.



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

def initialize parser: Parsers::Assembler.new, processors: PROCESSORS
  @parser = parser
  @processors = processors
end

Instance Method Details

#call(arguments = []) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rubysmith/cli/shell.rb', line 22

def call arguments = []
  parse arguments

  case options
    in config: Symbol => action then process_config action
    in build_minimum: true then process_build :build_minimum, options
    in build: then process_build :build_maximum, options
    in version: String => version then puts version
    in help: then usage
    else usage
  end
end