1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-09-17 10:17:07 +03:00

feat(args): update clap and clap extras to v4 (#137)

* feat(args): update clap to v4

* test(args): ensure cli opts are valid

* chore(deps): update clap dependencies

---------

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
This commit is contained in:
Lygon Bowen-West 2023-02-08 15:53:57 +00:00 committed by GitHub
parent 38943e8bac
commit 0e710c256b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 177 additions and 118 deletions

191
Cargo.lock generated
View File

@ -28,9 +28,9 @@ dependencies = [
[[package]]
name = "async-trait"
version = "0.1.62"
version = "0.1.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "689894c2db1ea643a50834b999abf1c110887402542955ff5451dab8f861f9ed"
checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2"
dependencies = [
"proc-macro2",
"quote",
@ -43,7 +43,7 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"hermit-abi 0.1.19",
"libc",
"winapi",
]
@ -77,9 +77,9 @@ dependencies = [
[[package]]
name = "bstr"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b"
checksum = "b7f0778972c64420fdedc63f09919c8a88bda7b25135357fd25a5d9f3257e832"
dependencies = [
"memchr",
"serde",
@ -93,9 +93,9 @@ checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
[[package]]
name = "cc"
version = "1.0.78"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
dependencies = [
"jobserver",
]
@ -142,36 +142,34 @@ dependencies = [
[[package]]
name = "clap"
version = "3.2.23"
version = "4.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"clap_lex",
"indexmap",
"is-terminal",
"once_cell",
"strsim",
"termcolor",
"terminal_size",
"textwrap",
]
[[package]]
name = "clap_complete"
version = "3.2.5"
version = "4.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f7a2e0a962c45ce25afce14220bc24f9dade0a1787f185cecf96bfba7847cd8"
checksum = "3d6540eedc41f8a5a76cf3d8d458057dcdf817be4158a55b5f861f7a5483de75"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "3.2.18"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
dependencies = [
"heck",
"proc-macro-error",
@ -182,18 +180,18 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.2.4"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "clap_mangen"
version = "0.1.11"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "105180c05a72388d5f5e4e4f6c79eecb92497bda749fa8f963a16647c5d5377f"
checksum = "eb258c6232b4d728d13d6072656627924c16707aae6267cd5a1ea05abff9a25c"
dependencies = [
"clap",
"roff",
@ -270,9 +268,9 @@ dependencies = [
[[package]]
name = "cxx"
version = "1.0.87"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b61a7545f753a88bcbe0a70de1fcc0221e10bfc752f576754fa91e663db1622e"
checksum = "bc831ee6a32dd495436e317595e639a587aa9907bef96fe6e6abc290ab6204e9"
dependencies = [
"cc",
"cxxbridge-flags",
@ -282,9 +280,9 @@ dependencies = [
[[package]]
name = "cxx-build"
version = "1.0.87"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f464457d494b5ed6905c63b0c4704842aba319084a0a3561cdc1359536b53200"
checksum = "94331d54f1b1a8895cd81049f7eaaaef9d05a7dcb4d1fd08bf3ff0806246789d"
dependencies = [
"cc",
"codespan-reporting",
@ -297,15 +295,15 @@ dependencies = [
[[package]]
name = "cxxbridge-flags"
version = "1.0.87"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43c7119ce3a3701ed81aca8410b9acf6fc399d2629d057b87e2efa4e63a3aaea"
checksum = "48dcd35ba14ca9b40d6e4b4b39961f23d835dbb8eed74565ded361d93e1feb8a"
[[package]]
name = "cxxbridge-macro"
version = "1.0.87"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65e07508b90551e610910fa648a1878991d367064997a596135b86df30daf07e"
checksum = "81bbeb29798b407ccd82a3324ade1a7286e0d29851475990b612670f6f5124d2"
dependencies = [
"proc-macro2",
"quote",
@ -513,9 +511,9 @@ dependencies = [
[[package]]
name = "git2"
version = "0.16.0"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be36bc9e0546df253c0cc41fd0af34f5e92845ad8509462ec76672fac6997f5b"
checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc"
dependencies = [
"bitflags",
"libc",
@ -562,9 +560,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "heck"
version = "0.4.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
@ -575,6 +573,12 @@ dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "856b5cb0902c2b6d65d5fd97dfa30f9b70c7538e770b98eab5ed52d8db923e01"
[[package]]
name = "humansize"
version = "1.1.1"
@ -653,12 +657,24 @@ dependencies = [
[[package]]
name = "io-lifetimes"
version = "1.0.4"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
dependencies = [
"libc",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
name = "is-terminal"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef"
dependencies = [
"hermit-abi 0.3.0",
"io-lifetimes",
"rustix",
"windows-sys 0.45.0",
]
[[package]]
@ -678,9 +694,9 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.60"
version = "0.3.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
dependencies = [
"wasm-bindgen",
]
@ -722,9 +738,9 @@ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "libgit2-sys"
version = "0.14.1+1.5.0"
version = "0.14.2+1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a07fb2692bc3593bda59de45a502bb3071659f2c515e28c71e728306b038e17"
checksum = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4"
dependencies = [
"cc",
"libc",
@ -868,9 +884,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pest"
version = "2.5.3"
version = "2.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4257b4a04d91f7e9e6290be5d3da4804dd5784fafde3a497d73eb2b4a158c30a"
checksum = "028accff104c4e513bad663bbcd2ad7cfd5304144404c31ed0a77ac103d00660"
dependencies = [
"thiserror",
"ucd-trie",
@ -878,9 +894,9 @@ dependencies = [
[[package]]
name = "pest_derive"
version = "2.5.3"
version = "2.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "241cda393b0cdd65e62e07e12454f1f25d57017dcc514b1514cd3c4645e3a0a6"
checksum = "2ac3922aac69a40733080f53c1ce7f91dcf57e1a5f6c52f421fadec7fbdc4b69"
dependencies = [
"pest",
"pest_generator",
@ -888,9 +904,9 @@ dependencies = [
[[package]]
name = "pest_generator"
version = "2.5.3"
version = "2.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46b53634d8c8196302953c74d5352f33d0c512a9499bd2ce468fc9f4128fa27c"
checksum = "d06646e185566b5961b4058dd107e0a7f56e77c3f484549fb119867773c0f202"
dependencies = [
"pest",
"pest_meta",
@ -901,9 +917,9 @@ dependencies = [
[[package]]
name = "pest_meta"
version = "2.5.3"
version = "2.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ef4f1332a8d4678b41966bb4cc1d0676880e84183a1ecc3f4b69f03e99c7a51"
checksum = "e6f60b2ba541577e2a0c307c8f39d1439108120eb7903adeb6497fa880c59616"
dependencies = [
"once_cell",
"pest",
@ -1009,9 +1025,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.50"
version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
dependencies = [
"unicode-ident",
]
@ -1155,16 +1171,16 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.36.7"
version = "0.36.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
"windows-sys 0.45.0",
]
[[package]]
@ -1238,9 +1254,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.91"
version = "1.0.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
checksum = "7434af0dc1cbd59268aa98b4c22c131c0584d2232f6fb166efb993e2832e896a"
dependencies = [
"itoa",
"ryu",
@ -1344,16 +1360,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb20089a8ba2b69debd491f8d2d023761cbf196e999218c591fa1e7e15a21907"
dependencies = [
"rustix",
"windows-sys",
]
[[package]]
name = "textwrap"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
dependencies = [
"terminal_size",
"windows-sys 0.42.0",
]
[[package]]
@ -1396,9 +1403,9 @@ dependencies = [
[[package]]
name = "tinyvec_macros"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "toml"
@ -1491,9 +1498,9 @@ dependencies = [
[[package]]
name = "unicode-bidi"
version = "0.3.9"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0046be40136ef78dc325e0edefccf84ccddacd0afcc1ca54103fa3c61bbdab1d"
checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58"
[[package]]
name = "unicode-ident"
@ -1595,9 +1602,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.83"
version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@ -1605,9 +1612,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.83"
version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
dependencies = [
"bumpalo",
"log",
@ -1620,9 +1627,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.83"
version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -1630,9 +1637,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.83"
version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
dependencies = [
"proc-macro2",
"quote",
@ -1643,15 +1650,15 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.83"
version = "0.2.84"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
[[package]]
name = "web-sys"
version = "0.3.60"
version = "0.3.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
dependencies = [
"js-sys",
"wasm-bindgen",
@ -1722,6 +1729,30 @@ dependencies = [
"windows_x86_64_msvc",
]
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.1"

View File

@ -31,15 +31,15 @@ regex.workspace = true
pretty_env_logger = "0.4.0"
log = "0.4.17"
dirs-next = "2.0.0"
clap_complete = "3.2.5"
clap_mangen = "0.1.11"
clap_complete = "4.1.1"
clap_mangen = "0.2.7"
[dependencies.git-cliff-core]
version = "1.1.2" # managed by release.sh
path = "../git-cliff-core"
[dependencies.clap]
version = "3.2.22"
version = "4.1.4"
features = ["derive", "env", "wrap_help"]
[dependencies.update-informer]

View File

@ -1,20 +1,20 @@
use clap::{
AppSettings,
ArgEnum,
ArgAction,
Parser,
ValueEnum,
};
use git_cliff_core::DEFAULT_CONFIG;
use glob::Pattern;
use std::path::PathBuf;
#[derive(Debug, Clone, Copy, ArgEnum)]
#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum Strip {
Header,
Footer,
All,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ArgEnum)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
pub enum Sort {
Oldest,
Newest,
@ -22,68 +22,85 @@ pub enum Sort {
/// Command-line arguments to parse.
#[derive(Debug, Parser)]
#[clap(
#[command(
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"))
disable_help_flag = true,
disable_version_flag = true,
)]
pub struct Opt {
#[arg(
short,
long,
action = ArgAction::Help,
global = true,
help = "Prints help information",
help_heading = "FLAGS"
)]
pub help: Option<bool>,
#[arg(
short = 'V',
long,
action = ArgAction::Version,
global = true,
help = "Prints version information",
help_heading = "FLAGS"
)]
pub version: Option<bool>,
/// Increases the logging verbosity.
#[clap(short, long, parse(from_occurrences), alias = "debug", help_heading = Some("FLAGS"))]
#[arg(short, long, action = ArgAction::Count, alias = "debug", help_heading = Some("FLAGS"))]
pub verbose: u8,
/// Sets the configuration file.
#[clap(short, long, env = "GIT_CLIFF_CONFIG", value_name = "PATH", default_value = DEFAULT_CONFIG)]
#[arg(short, long, env = "GIT_CLIFF_CONFIG", value_name = "PATH", default_value = DEFAULT_CONFIG)]
pub config: PathBuf,
/// Sets the working directory.
#[clap(short, long, env = "GIT_CLIFF_WORKDIR", value_name = "PATH")]
#[arg(short, long, env = "GIT_CLIFF_WORKDIR", value_name = "PATH")]
pub workdir: Option<PathBuf>,
/// Sets the git repository.
#[clap(
#[arg(
short,
long,
env = "GIT_CLIFF_REPOSITORY",
value_name = "PATH",
multiple_values = true
num_args(1..)
)]
pub repository: Option<Vec<PathBuf>>,
/// Sets the path to include related commits.
#[clap(
#[arg(
long,
env = "GIT_CLIFF_INCLUDE_PATH",
value_name = "PATTERN",
multiple_values = true
num_args(1..)
)]
pub include_path: Option<Vec<Pattern>>,
/// Sets the path to exclude related commits.
#[clap(
#[arg(
long,
env = "GIT_CLIFF_EXCLUDE_PATH",
value_name = "PATTERN",
multiple_values = true
num_args(1..)
)]
pub exclude_path: Option<Vec<Pattern>>,
/// Sets custom commit messages to include in the changelog.
#[clap(
#[arg(
long,
env = "GIT_CLIFF_WITH_COMMIT",
value_name = "MSG",
multiple_values = true
num_args(1..)
)]
pub with_commit: Option<Vec<String>>,
/// Prepends entries to the given changelog file.
#[clap(short, long, env = "GIT_CLIFF_PREPEND", value_name = "PATH")]
#[arg(short, long, env = "GIT_CLIFF_PREPEND", value_name = "PATH")]
pub prepend: Option<PathBuf>,
/// Writes output to the given file.
#[clap(short, long, env = "GIT_CLIFF_OUTPUT", value_name = "PATH")]
#[arg(short, long, env = "GIT_CLIFF_OUTPUT", value_name = "PATH")]
pub output: Option<PathBuf>,
/// Sets the tag for the latest version.
#[clap(
#[arg(
short,
long,
env = "GIT_CLIFF_TAG",
@ -92,7 +109,7 @@ pub struct Opt {
)]
pub tag: Option<String>,
/// Sets the template for the changelog body.
#[clap(
#[arg(
short,
long,
env = "GIT_CLIFF_TEMPLATE",
@ -101,34 +118,45 @@ pub struct Opt {
)]
pub body: Option<String>,
/// Writes the default configuration file to cliff.toml
#[clap(short, long, help_heading = Some("FLAGS"))]
#[arg(short, long, help_heading = Some("FLAGS"))]
pub init: bool,
/// Processes the commits starting from the latest tag.
#[clap(short, long, help_heading = Some("FLAGS"))]
#[arg(short, long, help_heading = Some("FLAGS"))]
pub latest: bool,
/// Processes the commits that belong to the current tag.
#[clap(long, help_heading = Some("FLAGS"))]
#[arg(long, help_heading = Some("FLAGS"))]
pub current: bool,
/// Processes the commits that do not belong to a tag.
#[clap(short, long, help_heading = Some("FLAGS"))]
#[arg(short, long, help_heading = Some("FLAGS"))]
pub unreleased: bool,
/// Sorts the tags topologically.
#[clap(long, help_heading = Some("FLAGS"))]
#[arg(long, help_heading = Some("FLAGS"))]
pub topo_order: bool,
/// Prints changelog context as JSON.
#[clap(long, help_heading = Some("FLAGS"))]
#[arg(long, help_heading = Some("FLAGS"))]
pub context: bool,
/// Strips the given parts from the changelog.
#[clap(short, long, value_name = "PART", arg_enum)]
#[arg(short, long, value_name = "PART", value_enum)]
pub strip: Option<Strip>,
/// Sets sorting of the commits inside sections.
#[clap(
#[arg(
long,
arg_enum,
value_enum,
default_value_t = Sort::Oldest
)]
pub sort: Sort,
/// Sets the commit range to process.
#[clap(value_name = "RANGE", help_heading = Some("ARGS"))]
#[arg(value_name = "RANGE", help_heading = Some("ARGS"))]
pub range: Option<String>,
}
#[cfg(test)]
mod tests {
use super::*;
use clap::CommandFactory;
#[test]
fn verify_cli() {
Opt::command().debug_assert()
}
}

View File

@ -1,6 +1,6 @@
use clap::{
ArgEnum,
CommandFactory,
ValueEnum,
};
use clap_complete::Shell;
use git_cliff::args::Opt;

View File

@ -12,7 +12,7 @@ use args::{
Strip,
};
use changelog::Changelog;
use clap::ArgEnum;
use clap::ValueEnum;
use git_cliff_core::commit::Commit;
use git_cliff_core::config::Config;
use git_cliff_core::embed::EmbeddedConfig;