Read results as JSON
The default text output is written for people: its layout differs from one command to the next and can change. For a script, ask for JSON or YAML. Every command then answers with the same envelope, for successes and for errors, so your script checks one field to know what happened.
Choose the output format
--output text (default)
Readable text, different for each command. Don't parse it.
--output json or --json
The JSON envelope, indented.
--output yaml or --yaml
The same envelope, in YAML.
These options work with every command. Use only one of them per command: --json with --yaml, or --json with --output yaml, stops the command with the error conflictingOptions. --json with --output json is accepted.
devo vault list --jsonThe envelope
{
"status": "success",
"command": "vault.list",
"operationId": null,
"data": [ ],
"warnings": [],
"errors": []
}status
success, partial, or error. Check this field first. partial means the command completed but some items failed: data holds what succeeded, errors lists what didn't, and the exit code is 0.
command
The command that ran, as a dotted path such as vault.list or entry.references. Aliases and option values don't change it.
operationId
An identifier when the command produced one, otherwise null.
data
The result. Its shape depends on the command.
warnings
Notices that didn't stop the command.
errors
One item per error. Empty when status is success; not empty when it's partial or error.
Each item in errors has these fields:
code
A stable error code, such as missingParameter or conflictingOptions. Base your script's decisions on this field.
message
An explanation for people. Its wording can change, so don't match on it.
target
The option, argument, or resource the error is about, when known.
blockerStatus, stageStatuses
Details from the workspace runtime, when the error comes from it.
A command line that Devolutions CLI can't parse, such as a misspelled command, also returns the envelope, with errors coded usageError, and sometimes a usageSuggestion item that proposes the right spelling.
Use it in a script
Check the exit code first, then read the envelope. A partial result exits with 0, so also report errors when the exit code is 0. For example, with jq:
The exit codes are listed in Exit codes and errors.
Standard output and standard error
Standard output
The envelope, in JSON or YAML, for successes and errors. In text, the result. In text, errors from devo login and from commands available only on Devolutions Cloud or only on Devolutions Server also go here, as <code>: <message>.
Standard error
In text, most errors, as <code>: <message>. Notices about what Devolutions CLI is doing, such as Starting Devolutions CLI daemon..., and the prompts and messages of interactive sign-in.
So in JSON or YAML, read standard output only: it contains exactly one envelope. The exception is devo secret run, described below.
Quiet or verbose
Notices about what Devolutions CLI is doing, such as starting the background process, are written to standard error:
In text output, they appear by default.
--quiethides them.In JSON or YAML output, they're hidden by default.
--verboseshows them, still on standard error.
--quiet and --verbose together stop the command with conflictingOptions.
Good to know
devo secret rundoesn't wrap the output of the program it starts: the program's output goes to your terminal as the program writes it, with secret values masked. How its own errors come back depends on when they happen:A launch Devolutions CLI rejects before resolving anything, such as a reference in the command's arguments (
secretLaunchArgumentReference), a failed--check, or a program that can't start, returns the envelope on standard output with--jsonor--yaml.A reference that doesn't resolve is always written to standard error as
<code>: <message>, even with--json, and the program doesn't start.A program stopped by
--timeout-secondsexits with124; an interrupted run exits with130.Otherwise,
devo secret runreturns the program's own exit code. See Exit codes and errors.
Every command and its options are in Commands.
Next
Last updated
Was this helpful?