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)) : Int32
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. Returns the program
exit code from the command, by default it is 0.
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_commandmethod. -
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_runhook is executed with the resolved arguments and options. -
The evaluated arguments and options are finalized: missing, unknown and invalid arguments/ options trigger the necessary missing/unknown/invalid command hooks.
-
The
Command#runandCommand#post_runmethods are executed with the evaluated arguments and options. -
The program exit code is returned from the command, or
0if noExitProgramexception was raised during the command's execution.