Class: Cliqr::Executor::Runner Private
- Inherits:
-
Object
- Object
- Cliqr::Executor::Runner
- Defined in:
- lib/cliqr/executor/runner.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The command runner that handles errors as well
Instance Method Summary collapse
-
#execute(args, options) ⇒ Integer
private
Execute the command.
-
#initialize(config) ⇒ Runner
constructor
private
Create a new command runner.
Constructor Details
#initialize(config) ⇒ Runner
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new command runner
16 17 18 19 |
# File 'lib/cliqr/executor/runner.rb', line 16 def initialize(config) @config = config @validator = Cliqr::ArgumentValidation::Validator.new end |
Instance Method Details
#execute(args, options) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute the command
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cliqr/executor/runner.rb', line 27 def execute(args, ) args = Cliqr::Util.sanitize_args(args, @config) action_config, parsed_input = parse(args) begin command_context = Command::CommandContext.build(action_config, parsed_input, ) \ do |forwarded_args, | execute(forwarded_args, .merge()) end Executor::Router.new(action_config).handle(command_context, **) rescue StandardError => e raise Cliqr::Error::CommandRuntimeError.new( "command '#{action_config.command}' failed", e) end end |