Sha256: d4398bd15b1c2a70c436b9fb41c89a234ec41dc3a8ca4627fe5dc520da0df468
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module Tocer module CLI # The main Command Line Interface (CLI) object. class Shell PROCESSORS = {config: Processors::Config.new, build: Processors::Build.new}.freeze def initialize parser: Parsers::Assembler.new, processors: PROCESSORS @parser = parser @processors = processors end 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 attr_reader :parser, :processors def parse arguments = [] parser.call arguments rescue StandardError => error puts error.message end 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 end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tocer-12.2.0 | lib/tocer/cli/shell.rb |
tocer-12.1.0 | lib/tocer/cli/shell.rb |
tocer-12.0.4 | lib/tocer/cli/shell.rb |
tocer-12.0.3 | lib/tocer/cli/shell.rb |