1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#[derive(clap::Parser)]
#[command(about, author, version)]
#[command(
color = concolor_clap::color_choice(),
allow_missing_positional = true,
)]
#[command(group = clap::ArgGroup::new("mode").multiple(false).required(true))]
pub struct Args {
#[arg(default_value = "HEAD")]
pub rev: String,
#[arg(required = true, group = "mode")]
pub file: Option<std::path::PathBuf>,
#[arg(long, value_name = "PATH", group = "mode")]
pub dump_config: Option<std::path::PathBuf>,
/// Display all supported languages
#[arg(long, group = "mode")]
pub list_languages: bool,
/// Display all supported highlighting themes
#[arg(long, group = "mode")]
pub list_themes: bool,
/// Display acknowledgements
#[arg(long, hide_short_help = true, group = "mode")]
pub acknowledgements: bool,
/// Display information for bug reports.
#[arg(long, hide_short_help = true, group = "mode")]
pub diagnostic: bool,
/// Run as if git was started in `PATH` instead of the current working directory.
///
/// When multiple `-C` options are given, each subsequent
/// non-absolute `-C <path>` is interpreted relative to the preceding `-C <path>`. If `<path>` is present but empty, e.g. `-C ""`, then the
/// current working directory is left unchanged.
///
/// This option affects options that expect path name like `--git-dir` and `--work-tree` in that their interpretations of the path names
/// would be made relative to the working directory caused by the `-C` option. For example the following invocations are equivalent:
///
/// git --git-dir=a.git --work-tree=b -C c status
/// git --git-dir=c/a.git --work-tree=c/b status
#[arg(short = 'C', hide = true, value_name = "PATH")]
pub current_dir: Option<Vec<std::path::PathBuf>>,
#[command(flatten)]
pub(crate) color: concolor_clap::Color,
#[command(flatten)]
pub verbose: clap_verbosity_flag::Verbosity<clap_verbosity_flag::InfoLevel>,
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn verify_app() {
use clap::CommandFactory;
Args::command().debug_assert()
}
}