pub fn render_docs(registry: &Registry) -> StringExpand description
Render a full Markdown reference document for all commands in a registry.
The output contains:
- A
# Commandstop-level heading. - A table of contents: a bulleted list of anchor links to each command in depth-first order. Subcommands are indented by two spaces per level beyond the first.
- Each command rendered with
render_markdown, separated by---lines.
§Arguments
registry— The registry whose commands should be documented.
§Examples
let registry = Registry::new(vec![
Command::builder("deploy")
.summary("Deploy the application")
.subcommand(Command::builder("rollback").summary("Roll back").build().unwrap())
.build()
.unwrap(),
Command::builder("status").summary("Show status").build().unwrap(),
]);
let docs = render_docs(®istry);
assert!(docs.contains("# Commands"));
assert!(docs.contains("# deploy"));
assert!(docs.contains("# rollback"));
assert!(docs.contains("# status"));
assert!(docs.contains("---"));