module Cling::Executor
Overview
Handles the execution of commands. In most cases you should never need to interact with this
module as the Command#execute
method is the main entrypoint for executing commands. For this
reason, most of the modules methods are hidden.
Defined in:
cling/executor.crClass Method Summary
-
.handle(command : Command, results : Array(Parser::Result)) : Nil
Handles the execution of a command using the given results from the parser.
Class Method Detail
Handles the execution of a command using the given results from the parser.
Process
-
The command is resolved first using a pointer to the results to prevent having to deal with multiple copies of the same object, and is mutated in the
resolve_command
method. -
The results are evaluated with the command arguments and options to set their values and move the missing, unknown and invalid arguments/options into place.
-
The
Command#pre_run
hook is executed with the resolved arguments and options, and the response is checked for continuation. -
The evaluated arguments and options are finalized: missing, unknown and invalid arguments/ options trigger the necessary missing/unknown/invalid command hooks.
-
The main
Command#run
andCommand#post_run
methods are executed with the evaluated arguments and options.