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 (14)

View Page History
usage: Petals JMX Command Line Interface

[-d] [-y] [-h <host>] [-n <port>] [-u <user>] [-p <password>] [-H | -V | -f <file> [--file ] <filename> | -c <command> <command-args> | -C]

-c,--command <command> Execute a command given on the command line.
-C,--console Enable the mode 'console'.
-d,--debug Print stack trace and debugging informations
-f,--file --file <filename> Enable the script file execution. If filename is '-', commands are read from the stdin.
-H,--help Print this help message and exit.
-h,--host <host> remote petals ESB host name.
Launching the Petals CLI with the following command line executes commands of a Petals script:
{code}
> ./petals-cli.sh -f <filename>
> ./petals-cli.sh --file <filename>
{code}
{info}A Petals script is text file containing command supported by Petals CLI.{info}
Launching the Petals CLI with the following command line executes commands provided through the 'stdin':
{code}
> cat <filename> | ./petals-cli.sh -f -
> cat <filename> | ./petals-cli.sh --file -
> ./petals-cli.sh -f - << EOF
<command1> <command1-args>
<command2> <command2-args>
EOF
> ./petals-cli.sh --file - << EOF
<command1> <command1-args>
<command2> <command2-args>
EOF
{code}

- the return code of the command can be check using the commands *{{isParsingErrorReturned}}*, *{{isExecutionErrorReturned}}*, *{{isNoErrorReturned}}*, the ternary conditional operator, and the attribute *{{lastErrorCode}}*:
{code}
> ./petals-cli.sh -f - << EOF
deploy <artifact-url>
isNoErrorReturned ? listartefacts : exit lastErrorCode
- In mode 'script', the connexion is establish on command 'open' to localhost:7700 with credentials 'petals/petals'
{code}
> ./petals-cli.sh -f - << EOF
open
EOF
To deploy several artifact in one command, just put them in a local directory and execute the command '*{{deploy}}*':
{code}
> ./petals-cli.sh -y -f - << EOF
deploy /tmp
EOF
To undeploy several artifact in one command, just put them in a local directory and execute the command '*{{undeploy}}*':
{code}
> ./petals-cli.sh -y -f - << EOF
undeploy
EOF
A flow of commands can be interrupted using the command '*{{exit}}*'. If a number is set as argument, it is used as return code. The argument '{{lastErrorCode}}' is used as return code value of the last executed command. Otherwise the return code 0 is returned to the shell:
{code}
> ./petals-cli.sh -y -f - << EOF
deploy /tmp/my-artifact.zip
exit lastErrorCode
When the end of a flow of commands is reached, if the last command is not '{{exit}}', the command '{{exit lastErrorCode}}' is implicitly executed:
{code}
> ./petals-cli.sh -y -f - << EOF
deploy /tmp/my-artifact.zip
EOF