vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Generate the CLI reference and help from one command table
f380ab70420ddf24f68931fa26e1288aff4acca6 · Keenan Nemetz · 23d ago · parent c284cb2c
Generate the CLI reference and help from one command table
The CLI documented itself four ways: a usage string per command group, inline
"usage: vole ..." strings in error paths, a per-group accepted-flag list, and
docs/cli.md, which was hand-written and had already drifted. `vole help` never
listed `run list`, `run show` or `run logs`, though all three exist and
`vole run -h` documented them; the reference listed them.
Each group now declares its subcommands, its flags (with argument and a one-line
description), its notes and its links in one table, in the file that parses it.
Three things render from that table:
- `vole help` and `vole <group> -h`, which gain an Options section and now list
every command and every flag;
- `vole help --markdown`, which writes docs/cli.md;
- `checkAllowed`, which refuses a flag the subcommand does not document — the
per-group flag lists are gone, so the parser and the docs are one list.
verify regenerates docs/cli.md and fails on any difference, so the page cannot go
stale. cmd/vole/help_test.go checks that every flag has a description, that every
parsed flag is documented by some subcommand, that each subcommand accepts exactly
the flags it lists, and that the committed reference matches the binary.
Closes: 01M7359KQ6Z8W91N8WNWVV120B
.vole/workflows/verify.yaml +9
| @@ -76,6 +76,15 @@ jobs: | |||
| 76 | 76 | timeout: 5m | |
| 77 | 77 | - name: markdown links | |
| 78 | 78 | run: python3 scripts/check-links.py | |
| 79 | # docs/cli.md is generated from the command table in cmd/vole, so a stale | ||
| 80 | # page means the help and the reference disagree. Regenerate it here and | ||
| 81 | # fail on any difference rather than trusting whoever edited the CLI. | ||
| 82 | - name: cli reference | ||
| 83 | run: | | ||
| 84 | set -eu | ||
| 85 | go run -tags libsqlite3,sqlite_fts5 ./cmd/vole help --markdown > "${TMPDIR:-/tmp}/cli.md" | ||
| 86 | diff -u docs/cli.md "${TMPDIR:-/tmp}/cli.md" | ||
| 87 | timeout: 10m | ||
| 79 | 88 | - name: test | |
| 80 | 89 | run: go test -race -count=1 ./... | |
| 81 | 90 | timeout: 30m | |