feat: hidden hivectl markdown-docs subcommand emitting the cli reference as commonmark

This commit is contained in:
damocles 2026-06-05 20:46:35 +02:00 committed by mara
commit ad8a3a8cbf
3 changed files with 24 additions and 0 deletions

View file

@ -90,6 +90,15 @@ enum Cmd {
#[arg(long)]
fresh: bool,
},
/// Emit the full CLI reference as `CommonMark` to stdout.
///
/// Hidden tooling command (not part of day-to-day operator admin):
/// walks this binary's own clap command tree and renders every verb,
/// flag, and help string as markdown. Used by the docs build to keep
/// the published `hivectl` reference in lockstep with the code — no
/// hand-maintained command list to drift out of date.
#[command(hide = true)]
MarkdownDocs,
}
#[derive(Subcommand)]
@ -330,6 +339,10 @@ async fn main() -> Result<()> {
AgentsCmd::RestartAll { socket } => agents_restart_all(&socket).await,
},
Cmd::Choom { name, fresh } => choom(&name, fresh),
Cmd::MarkdownDocs => {
print!("{}", clap_markdown::help_markdown::<Cli>());
Ok(())
}
}
}