Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7059609 + 330711d commit 36a846fCopy full SHA for 36a846f
1 file changed
src/shared.rs
@@ -441,7 +441,7 @@ pub use self::clap::{
441
442
#[cfg(test)]
443
mod value_parser_tests {
444
- use super::{AsRange, ParseRenameFraction};
+ use super::{AsRange, AsTime, ParseRenameFraction};
445
use clap::Parser;
446
447
#[test]
@@ -479,4 +479,16 @@ mod value_parser_tests {
479
let c = Cmd::parse_from(["cmd", "-l=1,10"]);
480
assert_eq!(c.arg, Some(1..10));
481
}
482
+
483
+ #[test]
484
+ fn since() {
485
+ #[derive(Debug, clap::Parser)]
486
+ pub struct Cmd {
487
+ #[clap(long, long="since", value_parser = AsTime)]
488
+ pub arg: Option<gix::date::Time>,
489
+ }
490
491
+ let c = Cmd::parse_from(["cmd", "--since", "2 weeks ago"]);
492
+ assert!(matches!(c.arg, Some(gix::date::Time { .. })));
493
494
0 commit comments