Migrate to clap v4 and add a basic test

This commit is contained in:
Harsh Shandilya 2022-09-29 11:38:57 +05:30
parent 931d2ff403
commit 79f68075f2
No known key found for this signature in database

View file

@ -1,10 +1,9 @@
use clap::{AppSettings, Parser}; use clap::Parser;
#[derive(Parser)] #[derive(Parser)]
#[clap(author, version, about)] #[command(author, version, about)]
#[clap(global_setting(AppSettings::DeriveDisplayOrder))]
pub(crate) struct Opts { pub(crate) struct Opts {
#[clap(subcommand)] #[command(subcommand)]
pub(crate) subcommand: SubCommand, pub(crate) subcommand: SubCommand,
} }
@ -27,6 +26,16 @@ pub(crate) struct Thaw {
/// directory to put cloned repos into. /// directory to put cloned repos into.
pub(crate) directory: String, pub(crate) directory: String,
/// the lockfile to restore repositories from. /// the lockfile to restore repositories from.
#[clap(default_value = "gitice.lock")] #[arg(default_value = "gitice.lock")]
pub(crate) lockfile: String, pub(crate) lockfile: String,
} }
#[cfg(test)]
mod test {
use super::Opts;
#[test]
fn cli_assert() {
<Opts as clap::CommandFactory>::command().debug_assert()
}
}