Available on crate feature
help only.Expand description
Styled help extracted from Clap and rendered as a semantic document.
App prints help for you. These functions serve a CLI that
drives its own lifecycle. document turns a Clap command into a
Document, and the try_emit functions print it when the arguments
ask for help. Help uses the same renderer, theme, and width policy as
command output.
use clap::Parser;
use ctl_core::help::document;
#[derive(Parser)]
#[command(name = "toy", about = "A toy")]
struct Cli {}
let help = document(<Cli as clap::CommandFactory>::command());
assert!(!help.is_empty());Functions§
- document
- Build the help document of a Clap command.
- emit_
bare_ with_ options - Print the root command’s help to stderr, as shown for a bare invocation of a command that requires input.
- try_
emit - Print styled help to stdout when the process argv asks for it, and return
true. Returnfalseand print nothing otherwise. - try_
emit_ from - Like
try_emit, readingargsin place of the process argv. The first item is the binary name. - try_
emit_ from_ with_ options - Like
try_emit, readingargsand rendering withoptions. - try_
emit_ with_ options - Like
try_emit, rendering withoptionsin place of the defaults.