Class: Ego::Runner
- Inherits:
-
Object
- Object
- Ego::Runner
- Defined in:
- lib/ego/runner.rb
Overview
The Runner class, given an array of arguments, initializes the required objects and executes the request.
Constant Summary collapse
- PROMPT =
Prompt to display in shell-mode
'ego, '.green.freeze
- QUIT =
Pattern that triggers shell-mode to exit
/^q(uit)?|exit|(good)?bye$/
Instance Method Summary collapse
-
#initialize(argv) ⇒ Runner
constructor
Takes an array of arguments and parses them into options:.
-
#run ⇒ void
Run the appropriate action based on the arguments provided to
#initialize.
Constructor Details
Instance Method Details
#run ⇒ void
This method returns an undefined value.
Run the appropriate action based on the arguments provided to
#initialize.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ego/runner.rb', line 30 def run case @options.mode when :help Printer.errs @options.usage_error, "\n" if @options.usage_error Printer.puts @options.usage exit(-1) if @options.usage_error when :version Printer.puts "ego v#{Ego::VERSION}" when :template helper = PluginHelper.new( query: (@options.query unless @options.query.empty?), program_name: @options.usage.program_name ) Printer.puts helper.template when :shell start_shell(robot_factory) else handle_query(robot_factory, @options.query) end rescue RobotError => e Printer.errs e. exit(-2) end |