class Milestoner::CLI::Shell
The main Command Line Interface (CLI
) object.
Constants
- ACTIONS
Attributes
actions[R]
container[R]
parser[R]
Public Class Methods
new(parser: Parsers::Assembler.new, actions: ACTIONS, container: Container)
click to toggle source
# File lib/milestoner/cli/shell.rb, line 13 def initialize parser: Parsers::Assembler.new, actions: ACTIONS, container: Container @parser = parser @actions = actions @container = container end
Public Instance Methods
call(arguments = [])
click to toggle source
# File lib/milestoner/cli/shell.rb, line 19 def call arguments = [] perform parser.call(arguments) rescue OptionParser::ParseError, Error => error logger.error error.message end
Private Instance Methods
config(action)
click to toggle source
# File lib/milestoner/cli/shell.rb, line 39 def config(action) = actions.fetch(__method__).call(action) def publish(configuration) = actions.fetch(__method__).call(configuration) def status = actions.fetch(__method__).call def usage = logger.unknown { parser.to_s } def logger = container[__method__] end
logger(= container[__method__])
click to toggle source
# File lib/milestoner/cli/shell.rb, line 47 def logger = container[__method__] end
perform(configuration)
click to toggle source
# File lib/milestoner/cli/shell.rb, line 29 def perform configuration case configuration in action_config: Symbol => action then config action in action_publish: true then publish configuration in action_status: true then status in action_version: String => version then logger.info version else usage end end
publish(configuration)
click to toggle source
# File lib/milestoner/cli/shell.rb, line 41 def publish(configuration) = actions.fetch(__method__).call(configuration) def status = actions.fetch(__method__).call def usage = logger.unknown { parser.to_s } def logger = container[__method__] end end
status(= actions.fetch(__method__).call)
click to toggle source
# File lib/milestoner/cli/shell.rb, line 43 def status = actions.fetch(__method__).call def usage = logger.unknown { parser.to_s } def logger = container[__method__] end end end
usage(= logger.unknown { parser.to_s })
click to toggle source
# File lib/milestoner/cli/shell.rb, line 45 def usage = logger.unknown { parser.to_s } def logger = container[__method__] end end