Skip to main content

Module generate

Module generate 

Source
Expand description

completions <shell> and man: the two commands whose output is the command tree.

Both render from Cli::command() — the same builder clap parses argv with — rather than from a script or a roff file checked in beside it. That is the whole reason they exist as generators: the CLI is deliberately not frozen before 1.0.0 (ADR 0001, in the book), so a hand-maintained completion script or man page goes stale at the first rename with nothing in CI to say so, while a generated one cannot.

Neither reads the configuration or the database, which is why src/main.rs answers them before it calls Config::load and Database::open — see the note there. Everything below is therefore a plain function over an injectable writer, so the tests assert on the bytes instead of on a process’s stdout.

Functions§

write
Routes the two generator commands.
write_completions
Writes the completion script for shell.
write_man
Writes the roff source of acme-proxy.1.