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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
use clap::{
AppSettings,
ArgEnum,
Parser,
};
use git_cliff_core::DEFAULT_CONFIG;
use glob::Pattern;
use std::path::PathBuf;
#[derive(Debug, Clone, Copy, ArgEnum)]
pub enum Strip {
Header,
Footer,
All,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ArgEnum)]
pub enum Sort {
Oldest,
Newest,
}
#[derive(Debug, Parser)]
#[clap(
version,
author,
about,
global_setting = AppSettings::DeriveDisplayOrder,
rename_all_env = "screaming-snake",
next_help_heading = Some("OPTIONS"),
override_usage = "git-cliff [FLAGS] [OPTIONS] [--] [RANGE]",
mut_arg("help", |arg| arg.help("Prints help information").help_heading("FLAGS")),
mut_arg("version", |arg| arg.help("Prints version information").help_heading("FLAGS"))
)]
pub struct Opt {
#[clap(short, long, parse(from_occurrences), alias = "debug", help_heading = Some("FLAGS"))]
pub verbose: u8,
#[clap(short, long, env = "GIT_CLIFF_CONFIG", value_name = "PATH", default_value = DEFAULT_CONFIG)]
pub config: PathBuf,
#[clap(short, long, env = "GIT_CLIFF_WORKDIR", value_name = "PATH")]
pub workdir: Option<PathBuf>,
#[clap(short, long, env = "GIT_CLIFF_REPOSITORY", value_name = "PATH")]
pub repository: Option<PathBuf>,
#[clap(
long,
env = "GIT_CLIFF_INCLUDE_PATH",
value_name = "PATTERN",
multiple_values = true
)]
pub include_path: Option<Vec<Pattern>>,
#[clap(
long,
env = "GIT_CLIFF_EXCLUDE_PATH",
value_name = "PATTERN",
multiple_values = true
)]
pub exclude_path: Option<Vec<Pattern>>,
#[clap(
long,
env = "GIT_CLIFF_WITH_COMMIT",
value_name = "MSG",
multiple_values = true
)]
pub with_commit: Option<Vec<String>>,
#[clap(short, long, env = "GIT_CLIFF_PREPEND", value_name = "PATH")]
pub prepend: Option<PathBuf>,
#[clap(short, long, env = "GIT_CLIFF_OUTPUT", value_name = "PATH")]
pub output: Option<PathBuf>,
#[clap(
short,
long,
env = "GIT_CLIFF_TAG",
value_name = "TAG",
allow_hyphen_values = true
)]
pub tag: Option<String>,
#[clap(
short,
long,
env = "GIT_CLIFF_TEMPLATE",
value_name = "TEMPLATE",
allow_hyphen_values = true
)]
pub body: Option<String>,
#[clap(short, long, help_heading = Some("FLAGS"))]
pub init: bool,
#[clap(short, long, help_heading = Some("FLAGS"))]
pub latest: bool,
#[clap(long, help_heading = Some("FLAGS"))]
pub current: bool,
#[clap(short, long, help_heading = Some("FLAGS"))]
pub unreleased: bool,
#[clap(long, help_heading = Some("FLAGS"))]
pub topo_order: bool,
#[clap(long, help_heading = Some("FLAGS"))]
pub context: bool,
#[clap(short, long, value_name = "PART", arg_enum)]
pub strip: Option<Strip>,
#[clap(
long,
arg_enum,
default_value_t = Sort::Oldest
)]
pub sort: Sort,
#[clap(value_name = "RANGE", help_heading = Some("ARGS"))]
pub range: Option<String>,
}