diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-06-02 12:13:53 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-06-02 13:17:57 +0200 |
commit | 4bd539bf0b4bcaee444a90c935bdfcb55fd2b1c5 (patch) | |
tree | dd7dad29703b7ce5416c132801c5994fae214e2a | |
parent | 7b28136408d8d002e625642a0e6b2bf9b792f5e1 (diff) |
Fix: About string should be settable for argument generator helper fn
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r-- | src/cli.rs | 24 |
1 files changed, 10 insertions, 14 deletions
@@ -1018,14 +1018,14 @@ pub fn cli<'a>() -> App<'a> { .subcommand(App::new("prune") .version(crate_version!()) .about("Remove exited containers") - .arg(arg_older_than_date()) - .arg(arg_newer_than_date()) + .arg(arg_older_than_date("Prune only containers older than DATE")) + .arg(arg_newer_than_date("Prune only containers newer than DATE")) ) .subcommand(App::new("stop") .version(crate_version!()) .about("Stop running containers") - .arg(arg_older_than_date()) - .arg(arg_newer_than_date()) + .arg(arg_older_than_date("Stop only containers older than DATE")) + .arg(arg_newer_than_date("Stop only containers newer than DATE")) .arg(Arg::new("timeout") .required(false) .multiple(false) @@ -1065,8 +1065,8 @@ pub fn cli<'a>() -> App<'a> { .about("List only containers of IMAGE") ) - .arg(arg_older_than_date()) - .arg(arg_newer_than_date()) + .arg(arg_older_than_date("List only containers older than DATE")) + .arg(arg_newer_than_date("List only containers newer than DATE")) ) .subcommand(App::new("top") .version(crate_version!()) @@ -1246,17 +1246,15 @@ fn dir_exists_validator(s: &str) -> Result<(), String> { } } -fn arg_older_than_date<'a>() -> Arg<'a> { +fn arg_older_than_date(about: &str) -> Arg<'_> { Arg::new("older_than") .required(false) .multiple(false) .long("older-than") .takes_value(true) .value_name("DATE") - .about("List only containers that are older than DATE") + .about(about) .long_about(r#" - List only containers that are older than DATE - DATE can be a freeform date, for example '2h' Supported suffixes: @@ -1277,17 +1275,15 @@ fn arg_older_than_date<'a>() -> Arg<'a> { .conflicts_with("newer_than") } -fn arg_newer_than_date<'a>() -> Arg<'a> { +fn arg_newer_than_date(about: &str) -> Arg<'_> { Arg::new("newer_than") .required(false) .multiple(false) .long("newer-than") .takes_value(true) .value_name("DATE") - .about("List only containers that are newer than DATE") + .about(about) .long_about(r#" - List only containers that are newer than DATE - DATE can be a freeform date, for example '2h' Supported suffixes: |