cradoc/cli/
args.rs

1use {
2    clap::{
3        CommandFactory,
4        Parser,
5    },
6    std::path::PathBuf,
7};
8
9static INTRO: &str = "
10cradoc updates any markdown file with a crate's lib documentation.
11
12See https://github.com/Canop/cradoc
13
14";
15
16/// Launch arguments
17#[derive(Debug, Parser)]
18#[command(
19    author,
20    about,
21    version,
22    disable_version_flag = true,
23    disable_help_flag = true
24)]
25pub struct Args {
26    /// Print help information
27    #[arg(long)]
28    pub help: bool,
29
30    /// Print the version
31    #[arg(long)]
32    pub version: bool,
33
34    pub path: Option<PathBuf>,
35}
36
37impl Args {
38    pub fn print_help(&self) {
39        let printer = clap_help::Printer::new(Args::command())
40            .with("introduction", INTRO)
41            .with("options", clap_help::TEMPLATE_OPTIONS_MERGED_VALUE)
42            .without("author");
43        printer.print_help();
44    }
45}