New Documentation of Petals CLI-Command Line Interface

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

Changes (1)

View Page History
{code}

h2. Return code of Petals CLI

h3. Return code when all is ok

When there is no error about options and arguments on the command line, the return code of Petals CLI is 0

h3. Return code on error about option or arguments on the command line

When there is an error about options and arguments on the command line, the return code of Petals CLI is 1

h3. Return code on error about option and arguments of a command

When there is an error about options and arguments of a command, the return code of Petals CLI is 1

h2. Error management

h3. Options et argument parsing error management

If an error of parsing of options and/or arguments of the command line or commands, Petals CLI is interrupted with the right return code.

h3. Error management of a command set on the command line

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

h3. Error management of a command entered in interactive mode (mode 'console')

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

h3. Error management of a command read from stdin or a file (mode 'script')

If an error occurs during the execution of a flow of commands:
- the command that has thrown the error is interrupted,
- the return code of the command can be check using the commands *isParsingErrorReturned*, *isExecutionErrorReturned*, *isNoErrorReturned* and the ternary conditional operator:
{code}
> ./petals-cli.sh -f - << EOF
deploy <artifact-url>
isNoErrorReturned ? listartefacts : exit 1
EOF
{code}

h2. Connection to a Petals node