Petals CLI

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (33)

View Page History
h2. Return codes of Petals CLI

h3. Return code on successful result
h3. Return code on error parsing mode options

When there is no error about options and arguments on the command line, the return code of Petals CLI is 0.
If Petals CLI is not able to determine the mode (interactive, scripting, executable or redirection) to use from arguments, the return code will be 1.

h3. Return code on error about options or arguments on the command line
h3. Return code of Petals CLI launched in interactive mode

When there is an error about options or arguments on the command line, the return code of Petals CLI is 1.
Petals CLI launched in interactive mode will exist always with the return code 0, even if error occurs executing a command.
If an error occurs during a command execution or parsing:
* The error message is displayed.
* Petals CLI is not interrupted, the user can enter other commands.

h3. Return code on error about options and arguments of a command
h3. Return codes of Petals CLI launched in executable mode

When there is an error about options and arguments of a command, the return code of Petals CLI is 1.
h4. Return code on parsing error of the command arguments

h3. Return code when executing a system command in Petals CLI
When there is an no error about options and arguments of the command, the return code of Petals CLI is 1.

When a system command is executed in Petals CLI, the return code is the one of the system command.
h4. Return code on command execution

h2. Error Management
When there is an no error about the command execution, the command is interrupted and the return code of Petals CLI is 2.

h3. Options and Arguments parsing
h4. Return code on successful command execution

When using the script mode or inlined mode, parsing errors (invalid options and/or arguments) result in an interruption of Petals CLI.
The right return code is then pushed back.
When there is no error about options, arguments and execution of a the command, the return code of Petals CLI is the return code of the command

h3. Error management of a command set on the command line
h3. Return code of commands

If an error occurs during the execution of a command set on the command line:
* The command is interrupted.
* Petals CLI is interrupted with the return code 2.
All commands return the return code 0 when the execution succeeds, and 1 when the execution fails. Except the command '{{system}}' that returns the return code of the system command invoked.

h3. Error management of a command in interactive mode
h3. Return codes of Petals CLI launched in scripting modes

If an error occurs during the execution of a command entered in interactive mode:
* The error message is displayed.
* Petals CLI is not interrupted, the user can enter other commands.
h4. Options and arguments parsing of command

h3. Error management of a command read from stdin or a file
When using the script mode or inlined mode, parsing errors (invalid options and/or arguments) result in an interruption of Petals CLI.
The return code 1 then pushed back.

h4. Error management of a command read from stdin or a file

If an error occurs during the execution of a flow of commands:
* The command that has thrown the error is interrupted.