Sha256: 4d282314ebf98f3ab64d54da12f4f5e20469944baed04ad68c5cad9877a01f08
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
<% namespace do %> module CLI # The main Command Line Interface (CLI) object. class Shell ACTIONS = {config: Actions::Config.new}.freeze def initialize parser: Parser.new, actions: ACTIONS, container: Container @parser = parser @actions = actions @container = container end def call arguments = [] perform parser.call(arguments) rescue OptionParser::ParseError => error logger.error { error.message } end private attr_reader :parser, :actions, :container def perform configuration case configuration in action_config: Symbol => action then config action in action_version: true then logger.info { specification.labeled_version } else usage end end def config(action) = actions.fetch(__method__).call(action) def usage = logger.unknown { parser.to_s } def specification = container[__method__] def logger = container[__method__] end end <% end %>
Version data entries
3 entries across 3 versions & 1 rubygems