Skip to content

usage lint

Lint a usage spec for mistakes that still parse

A spec can be valid KDL and still be wrong: a flag or subcommand declared twice, a required argument after an optional one, a variadic argument that is not last, a command or flag with no help, an example its own spec cannot parse. Each finding carries a code such as duplicate-flag, and --format json prints the findings as a list for a script to act on.

Exits 1 when there is an error, or a warning under --warnings-as-errors.

Arguments

  • <FILE> — A usage spec file, or a script with a usage shebang; "-" reads stdin

Flags

  • -f --format <FORMAT> — Output format

    Choices: text, json

    Default: text

  • -W --warnings-as-errors — Treat warnings as errors

  • --sorted — Also check that subcommands and flags are declared in sorted order

    Off by default: declaration order is a house convention rather than a correctness question, so a spec that keeps a different order is not wrong. Pair it with --warnings-as-errors to hold the order in CI.

  • -h --help — Print help

MIT LicenseCopyright © 2026jdx.dev