mirror of
https://github.com/msfjarvis/gitice
synced 2025-08-14 10:37:01 +05:30
Migrate to clap v4 and add a basic test
This commit is contained in:
parent
931d2ff403
commit
79f68075f2
1 changed files with 14 additions and 5 deletions
19
src/cli.rs
19
src/cli.rs
|
@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue