Skip to content

Output formats & exit codes

docmeta validate renders results in one of three formats, chosen with -f/--format. Whatever the format, the process exit code follows a fixed contract so CI can branch on it.

The default. Human-readable, one line per file, with per-error detail and a summary. A passing file is marked ; a failing file is marked .

✓ docs/intro.md
✗ docs/api.md
type must have required property 'type' (line 2) [google:okf:0.1]
2 files checked, 1 passed, 1 failed, 1 error

Each error line has the form:

<field> <message> (line N) [schema-id]
  • <field> is the failing field’s path, or (root) for a whole-document error such as a missing required field.
  • (line N) is omitted when no source line is known.
  • [schema-id] is the schema that produced the error.

The summary line is N files checked, M passed, K failed, E errors, where E is the total number of error lines across all files. Pass -q/--quiet to hide passing files and show only failures and the summary.

Code Meaning
0 All files passed (or nothing failed).
1 One or more files failed validation.
2 Operational or usage error (a DocmetaError) — for example, no inputs, an unknown --format, a missing config file, or an unresolvable schema.

Exit code 1 reflects validation failures in the documents. Exit code 2 reflects a problem running docmeta itself, and means no validation verdict was produced.

  • Primary output — the rendered report in any format — goes to stdout.
  • Diagnostics — operational errors that cause exit 2 — go to stderr, prefixed with docmeta: .

This separation lets you capture machine-readable output cleanly:

Terminal window
docmeta validate docs/ -f json > results.json

Color applies only to pretty output, and only when it is appropriate for the destination:

Condition Color
--no-color passed off
NO_COLOR environment variable set to a non-empty value off
stdout is not a TTY (e.g. piped or redirected) off
stdout is a TTY and none of the above on

The json and github formats are never colored.