clap_help/lib.rs
1/*!
2
3clap-help is an alternate help printer for applications using clap.
4
5clap-help displays arguments in a more readable format, in a width-aware table and lets you customize the content and style.
6
7Minimal usage:
8
91. disable the standard clap help printer with `disable_help_flag = true`
102. add your own help flag
113. call `clap_help::print_help` in the handler for your help flag
12
13```rust
14use clap::{CommandFactory, Parser, ValueEnum};
15use clap_help::Printer;
16
17#[derive(Parser, Debug)]
18#[command(name="my_prog", author, version, about, disable_help_flag = true)]
19struct Args {
20
21 /// Print help
22 #[arg(long)]
23 help: bool,
24
25 // other arguments
26}
27
28fn main() {
29 let args = Args::parse();
30 if args.help {
31 Printer::new(Args::command()).print_help();
32 return;
33 }
34
35 // rest of the program
36}
37
38```
39
40The examples directory shows how to customize the help.
41
42*/
43
44mod printer;
45
46pub use printer::*;