Output formats
Commands that read print a table for people by default. Add--output json (or -o json) to get JSON instead:
jq:
--output text (the default, one readable line per event) or --output json (one JSON document per line):
occtoo events subscribeocctoo events listocctoo events destinations pull(herejsonprints the whole batch as one document)
Data on stdout, messages on stderr
The CLI writes data to stdout and everything meant for people to stderr: prompts, spinners, progress bars and errors. That means you can pipe or redirect the output and still see progress in your terminal:JSON input
Commands that write, such ascreate and edit, take their input in one of two ways:
- Prompts. In a terminal, the CLI asks you for each value.
- JSON. Pass a JSON file with
--file(or-f), or pipe JSON to stdin.
--help to see the JSON it takes, with an example.
For edit commands, a field you leave out stays as it is.
No prompts outside a terminal
The CLI only asks questions when both stdin and stderr are a terminal. In a script it never waits for input. If it needs something you didn’t give, it stops with an error that names the flag or environment variable to set. Interactive pickers are only a shortcut. Everything they do is also possible with arguments, flags and JSON input.Confirm deletes with --yes
Commands that delete or throw away data ask for confirmation in a terminal. In a script, pass --yes (or -y). Without it, the command fails and tells you to pass --yes.
Exit codes
Error messages say what failed and what to do next. When a request to the API fails, the message includes the trace id of the request, which helps Occtoo support find it.
Long-running work
Some commands start work that runs in the background in Occtoo and wait until it is done, for exampleocctoo cards activate, occtoo lifecycles activate, occtoo destinations publish and occtoo cards export. Progress goes to stderr. Ctrl-C stops the waiting, not the work itself. Use the matching show command to check how far it is.