diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 5f0d0b1e8..ddabaabcd 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -15,7 +15,7 @@ edition = "2021" path = "src/mktemp.rs" [dependencies] -clap = { version = "3.2", features = ["wrap_help", "cargo"] } +clap = { version = "4.0", features = ["wrap_help", "cargo"] } rand = "0.8" tempfile = "3" uucore = { version=">=0.0.16", package="uucore", path="../../uucore" } diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 54e03ebc1..5e7234b76 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -8,7 +8,7 @@ // spell-checker:ignore (paths) GPGHome findxs -use clap::{crate_version, Arg, ArgMatches, Command}; +use clap::{crate_version, Arg, ArgAction, ArgMatches, Command}; use uucore::display::{println_verbatim, Quotable}; use uucore::error::{FromIo, UError, UResult, UUsageError}; use uucore::format_usage; @@ -197,12 +197,12 @@ impl Options { } }; Self { - directory: matches.contains_id(OPT_DIRECTORY), - dry_run: matches.contains_id(OPT_DRY_RUN), - quiet: matches.contains_id(OPT_QUIET), + directory: matches.get_flag(OPT_DIRECTORY), + dry_run: matches.get_flag(OPT_DRY_RUN), + quiet: matches.get_flag(OPT_QUIET), tmpdir, suffix: matches.get_one::(OPT_SUFFIX).map(String::from), - treat_as_template: matches.contains_id(OPT_T), + treat_as_template: matches.get_flag(OPT_T), template, } } @@ -340,7 +340,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = match uu_app().try_get_matches_from(&args) { Ok(m) => m, Err(e) => { - if e.kind == clap::error::ErrorKind::TooManyValues && e.info[0] == "