pub struct Help { /* private fields */ }
Expand description
Helper that can be formatted into documentation text.
Implementations§
source§impl Help
impl Help
sourcepub fn format(&self) -> HelpFormat<'_>
pub fn format(&self) -> HelpFormat<'_>
Format the help with the given config.
Examples
argwerk::define! {
/// A simple test command.
#[usage = "command [-h]"]
struct Args {
help: bool,
}
/// Prints the help.
///
/// This includes:
/// * All the available switches.
/// * All the available positional arguments.
/// * Whatever else the developer decided to put in here! We even support wrapping comments which are overly long.
["-h" | "--help"] => {
help = true;
}
}
let formatted = format!("{}", Args::help().format().width(120));
assert!(formatted.split('\n').any(|line| line.len() > 80));
assert!(formatted.split('\n').all(|line| line.len() < 120));