Forcing a format
-o text is the one worth remembering, for when you want the readable rendering in a file. yml is accepted as a spelling of yaml.
The stream split
stdout carries the success payload and nothing else. Progress, warnings, prompts, hints and error reports all go to stderr, and on failure stdout stays empty. That is what makesmailkube doctor is the single exception. It writes its whole report to stdout even when it exits non-zero. See Exit codes for why.
Projecting with --jq
--jq runs an expression over the output before it is written, using an embedded implementation. It behaves the same on a machine with no jq installed:
Branching on the result
Exit codes are part of the public contract and stable within a major version, socase $? is safe to write against:
Non-interactive behavior
Destructive commands prompt and default to no.-y answers yes, which is what a script needs:
-q suppresses progress and hints on stderr. It does not imply -y, and it never suppresses the payload or an error report. A quiet run that fails still tells you why.
Prompting also switches itself off where nobody can answer. When stdin is not a terminal, when CI, GITHUB_ACTIONS or MAILKUBE_NO_PROMPT is set to anything non-empty, or when TERM is dumb, the CLI never prompts. A question it cannot ask becomes a usage error, exit 2, telling you to pass -y. Assuming yes would cancel a batch nobody approved. Assuming no would report an operation as refused that was never attempted.
--timeout bounds a single API call, 30 seconds by default. Exceeding it exits 124, which is a different question from exit 9: 124 means the time you allowed ran out, 9 means the server was never reached.
Credentials in CI
Everything can come from the environment, and a CI job needs no config file:mailkube config list shows which of the three supplied each effective value.
Color
Color follows the terminal and the two conventions every tool honors:NO_COLOR turns it off, CLICOLOR_FORCE turns it on. --no-color does the same as the former for a single invocation. MAILKUBE_ASCII=1 swaps the badge glyphs for ASCII ones on a terminal that cannot draw them.
A worked example
Send a message, wait for the platform to say what happened to it, and fail the job if it never does:set -e fails the job on a message that was accepted and never delivered.