Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI reference

Full reference for the aozora binary. For a guided tour, see CLI Quickstart.

Synopsis

aozora <SUBCOMMAND> [OPTIONS] [ARGS]
SubcommandWhat it does
checkLex + report diagnostics.
fmtRound-trip parse ∘ serialize (canonicalise).
renderRender to HTML on stdout.
pandocProject to a Pandoc AST (JSON, or pipe through pandoc).
kindsTabulate every NodeKind / PairKind / Severity / … wire tag.
schemaPrint the JSON Schema for a wire envelope.
explainPrint short prose for a NodeKind tag.

There are no global options beyond clap’s -h/--help and -V/--version; the input-shaping flags below are per-subcommand. All document subcommands accept - (or no path) to read stdin.

Common flagSubcommandsEffect
-E, --encoding {auto,utf8,sjis}check / fmt / render / pandocSource encoding. Default auto — UTF-8 if the bytes are valid UTF-8, else Shift_JIS.

Colour follows the terminal and the NO_COLOR environment variable (miette honours it); there is no --no-color flag.

aozora check

aozora check [OPTIONS] [PATH]

Lex the source and report diagnostics. PATH of - (or omitted) reads from stdin.

OptionEffect
--strict, -sExit non-zero (1) on any diagnostic.
--encoding, -ESource encoding (see above).
--diagnostic-format {human,json,short}How to render diagnostics. Default auto: human when stderr is a terminal, json when piped.

The three formats:

  • human — a graphical miette report: the source line, a caret under the span, the label, the help, and a link to the diagnostics catalogue.
  • json — the aozora::wire diagnostics envelope, byte-identical to every other binding. The machine / agent path (the default when piped).
  • short — one grep-able line: path:offset: severity[code]: msg.

Exit codes: 0 (parse succeeded; diagnostics may have been printed but were tolerated), 1 (--strict and at least one diagnostic), 2 (usage error), 3 (an Internal-source diagnostic fired — a library bug, not bad input; please report it).

aozora check src.txt                       # human on a TTY, json when piped
aozora check --strict src.txt              # any diagnostic -> exit 1
aozora check -E sjis crime.txt             # Shift_JIS source
aozora check --diagnostic-format short -   # one line per diagnostic, from stdin
cat src.txt | aozora check                 # json envelope (stderr is piped)

aozora fmt

aozora fmt [OPTIONS] [PATH]

Round-trip the source through parse ∘ serialize. Default prints the canonical form on stdout.

OptionEffect
--checkExit non-zero if the formatted output differs from the input (after Phase 0 sanitize: BOM strip, CRLF→LF). Mutually exclusive with --write.
--writeOverwrite the input file with the canonical form. Ignored when reading from stdin.
--encoding, -ESource encoding (see above).

Exit codes: 0 (success, or no diff under --check), 1 (formatting mismatch under --check), 2 (usage error).

aozora fmt src.txt > formatted.txt
aozora fmt --check src.txt                 # CI gate
aozora fmt --write src.txt                 # in-place
cat src.txt | aozora fmt                    # stdin -> stdout

aozora render

aozora render [OPTIONS] [PATH]

Render the parsed tree to HTML on stdout. Accepts --encoding/-E.

aozora render src.txt > out.html
aozora render -E sjis crime.txt > crime.html
cat src.txt | aozora render -

The output is semantic HTML5 with aozora-* class hooks (no inline styles). See HTML renderer for the class-name reference.

aozora pandoc

aozora pandoc [OPTIONS] [PATH]

Project the parsed document to a Pandoc AST. Without --format/-t, prints Pandoc JSON to stdout (consumable by pandoc -f json -t …); with --format, spawns pandoc and pipes the JSON through it. Accepts --encoding/-E.

aozora pandoc src.txt | pandoc -f json -t epub3 -o out.epub
aozora pandoc src.txt -t latex > src.tex          # spawns pandoc directly

See Bindings → Pandoc.

Introspection subcommands

kinds, schema {diagnostics|nodes|pairs|container-pairs}, and explain <tag> print typed contracts and need no input file. They back the drift-gated wire artefacts; see Wire format.

Exit codes

CodeMeaning
0Success.
1Diagnostics under --strict, or a formatting mismatch under fmt --check, or a spawned tool (pandoc) exited non-zero.
2Usage error (bad flag, unreadable file, decode failure).
3An Internal-source diagnostic fired during check — a library bug.

Environment

VariableEffect
NO_COLORIf set (any value), disable ANSI colour in diagnostics output.
AOZORA_LOGtracing-subscriber filter (e.g. aozora_pipeline=debug). Internal debugging; not part of the stable surface.

See Reference → Environment variables for the full matrix.

See also