test: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 15:08:17 +01:00
parent 3cac8a631f
commit 0ff1984471
2 changed files with 5 additions and 7 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/test.rs"
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42"
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }

View file

@ -86,10 +86,10 @@ NOTE: your shell may have its own version of test and/or [, which usually supers
the version described here. Please refer to your shell's documentation
for details about the options it supports.";
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.setting(AppSettings::DisableHelpFlags)
.setting(AppSettings::DisableVersion)
.setting(AppSettings::DisableHelpFlag)
.setting(AppSettings::DisableVersionFlag)
}
#[uucore_procs::gen_uumain]
@ -104,12 +104,10 @@ pub fn uumain(mut args: impl uucore::Args) -> UResult<()> {
// Let clap pretty-print help and version
App::new(binary_name)
.version(crate_version!())
.usage(USAGE)
.override_usage(USAGE)
.after_help(AFTER_HELP)
// Disable printing of -h and -v as valid alternatives for --help and --version,
// since we don't recognize -h and -v as help/version flags.
.setting(AppSettings::NeedsLongHelp)
.setting(AppSettings::NeedsLongVersion)
.get_matches_from(std::iter::once(program).chain(args.into_iter()));
return Ok(());
}