Skip to navigation

Commands and flags

Output formats, paging, dry runs and environment variables.

Global flags

Every command accepts these:

FlagDoes
--format <json|table|yaml|csv|jsonl|raw|http>Output format. Default: table in a terminal, json when piped.
--humanKeep the table output even when piped.
--query <JMESPath>Keep only part of the response, for example --query 'data[].slug'.
--dry-runValidate the request and print it without sending it.
--base-url <url>Call another host.
-q, --quietPrint nothing on success. Errors still go to stderr.
--debugPrint the HTTP request and response to stderr.
--schemaPrint the JSON schema of the current command or group.

Request bodies

Set fields with flags, nested ones with dots:

ocpplab-cli evcharger commands start_session \
--target.identity DEMO-CP-001 \
--payload.id-tag TAG-001 --payload.connector-id 1

Or send the whole body as JSON, from an argument or stdin:

ocpplab-cli evcharger commands start_session --json '{"target": {"identity": "DEMO-CP-001"}, "payload": {"id_tag": "TAG-001"}}'
cat body.json | ocpplab-cli evcharger commands start_session --json -

--params '<json>' merges extra parameters and overrides individual flags.

Paging

List commands that page also accept:

FlagDoes
--page-allFetch every page and stream the items as NDJSON
--page-limit <n>Stop after n pages (default 10)
--page-delay <ms>Wait between pages (default 100)

Scripting

# Every brand slug, one per line
ocpplab-cli evcharger catalog list_brands --page-all | jq -r '.slug'
# Keep one field of a response
ocpplab-cli health live --query status
# Preview a destructive call before you run it
ocpplab-cli evcharger deployment delete --identity DEMO-CP-001 --dry-run

Exit code 0 means success. On an API error, the CLI prints the error to stderr and exits non-zero.

Environment variables

VariableDoes
OCPPLAB_TOKENSDK token. Takes precedence over auth login.
OCPPLAB_CLI_BASE_URLAPI host (--base-url wins)
OCPPLAB_CLI_OUTPUTDefault output format (--format wins)
OCPPLAB_CLI_RETRIESRetry attempts for failed requests
OCPPLAB_CLI_TIMEOUT_SECSTotal request timeout
OCPPLAB_CLI_PROXYHTTP(S) proxy URL. HTTPS_PROXY, HTTP_PROXY and NO_PROXY also work.
OCPPLAB_CLI_CA_BUNDLEPEM file with extra trusted certificates

Shell completion

ocpplab-cli completion zsh > "${fpath[1]}/_ocpplab-cli"

Also bash, fish and powershell.