Sha256: b1a09fb9e1374fb8b425e036aadfe22ad5ad6e8382af8b22ec7a63ac82c65164
Contents?: true
Size: 918 Bytes
Versions: 2
Compression:
Stored size: 918 Bytes
Contents
# frozen_string_literal: true require "core" module Pragmater module CLI # The main Command Line Interface (CLI) object. class Shell include Actions::Import[:config, :run, :specification, :logger] def initialize(parser: Parser.new, **) super(**) @parser = parser end def call arguments = Core::EMPTY_ARRAY act_on parser.call(arguments) rescue OptionParser::ParseError => error logger.error { error.message } end private attr_reader :parser def act_on configuration case configuration in action_config: Symbol => action then config.call action in {action_insert: true} | {action_remove: true} then run.call configuration in action_version: true then logger.info { specification.labeled_version } else logger.any { parser.to_s } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pragmater-12.1.2 | lib/pragmater/cli/shell.rb |
pragmater-12.1.1 | lib/pragmater/cli/shell.rb |