class Tocer::CLI::Shell
The main Command Line Interface (CLI
) object.
Constants
- PROCESSORS
Attributes
parser[R]
processors[R]
Public Class Methods
new(parser: Parsers::Assembler.new, processors: PROCESSORS)
click to toggle source
# File lib/tocer/cli/shell.rb, line 9 def initialize parser: Parsers::Assembler.new, processors: PROCESSORS @parser = parser @processors = processors end
Public Instance Methods
call(arguments = [])
click to toggle source
# File lib/tocer/cli/shell.rb, line 14 def call arguments = [] parse arguments case options in config: action then process_config action in build: path then process_build path in version: then puts version else usage end end
Private Instance Methods
options(= parser.to_h)
click to toggle source
# File lib/tocer/cli/shell.rb, line 39 def options = parser.to_h def usage = puts(parser.to_s) end end
parse(arguments = [])
click to toggle source
# File lib/tocer/cli/shell.rb, line 29 def parse arguments = [] parser.call arguments rescue StandardError => error puts error.message end
process_build(path)
click to toggle source
# File lib/tocer/cli/shell.rb, line 37 def process_build(path) = processors.fetch(:build).call(path, options) def options = parser.to_h def usage = puts(parser.to_s) end end end
process_config(action)
click to toggle source
# File lib/tocer/cli/shell.rb, line 35 def process_config(action) = processors.fetch(:config).call(action) def process_build(path) = processors.fetch(:build).call(path, options) def options = parser.to_h def usage = puts(parser.to_s) end end
usage(= puts(parser.to_s))
click to toggle source
# File lib/tocer/cli/shell.rb, line 41 def usage = puts(parser.to_s) end