Introduction to command syntax
All OLP CLI commands have the following structure:
olp <command group> <command> <arguments> [required and/or optional parameters]
For example:
olp pipeline create pipeline-name --scope <YOUR_PROJECT_HRN>
Passing parameters to the OLP CLI
The OLP CLI supports a set of characters that you can use to pass command parameters:
-
Space and equal (=
) separators.
By default, command parameters are separated with spaces, but you can also use the equal (=
) separator, as in the examples below:
olp catalog list --profile <your_profile_name>
or
olp catalog list --profile=<your_profile_name>
-
Tilde-prefix (~
).
If you are using the tilde-prefix (~
) to denote a user's home directory in Linux environments, you must use a space as tilde cannot be combined with the =
separator:
olp catalog layer stream put hrn:here:data::org:catalog1 stream-layer1 --input ~/path/to/dir
-
Pipe (|
) and dash (-
) characters.
The pipe (|
) character lets you take the output of one command and send it as input to another command. The dash (-
) character allows capturing that output and passing it to a certain parameter of the other command.
In the example below, the catalog show
command returns the configuration of the hrn:here:data::org:catalog-1
catalog in JSON format. The catalog update
command takes the hrn:here:data::org:catalog-1
configuration (through --config -
) to update the configuration of the hrn:here:data::org:catalog-2
catalog, including catalog summary, name, description, and layer configuration:
olp catalog show hrn:here:data::org:catalog-1 --json | olp catalog update hrn:here:data::org:catalog-2 --config -
The OLP CLI's default output is optimized for human readability. Such exit codes are used:
-
0
: returned when a command succeeds. -
1
: returned when a command was executed with invalid parameters. -
2
: returned when invalid configuration files were used. -
3
: returned when a command fails. -
4
: returned when a command was executed on non-existing resources (mostly catalogs).
All commands provide a --quiet
flag that allows reducing the output to essential values only with no additional information.
Commands that display output in the console support a --json
flag. Depending on the command, this flag shows more additional information in the output in the JSON format. You can also parse JSON output with a script.
Alternatively, you can set the OLP_OUTPUT
environment variable to json
or quiet
to choose the output format. However, the flags have a higher priority than the environment variable.
For example:
To disable a previously set output format, set OLP_OUTPUT
to verbose
, which is its default value.