Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Feb 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(args): ensure cli opts are valid
  • Loading branch information
lbowenwest committed Jan 15, 2023
commit f21a28e0b7947fcccc3df1e689dd39c9ea83bc15
33 changes: 31 additions & 2 deletions git-cliff/src/args.rs
Original file line number Diff line number Diff line change
@@ -29,10 +29,28 @@ pub enum Sort {
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.
#[arg(short, long, action = ArgAction::Count, alias = "debug", help_heading = Some("FLAGS"))]
pub verbose: u8,
@@ -131,3 +149,14 @@ pub struct Opt {
#[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()
}
}