diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 5f5885a6d..d419a6664 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -15,7 +15,7 @@ edition = "2021" path = "src/tty.rs" [dependencies] -clap = { version = "3.2", features = ["wrap_help", "cargo"] } +clap = { version = "4.0", features = ["wrap_help", "cargo"] } nix = "0.25" atty = "0.2" uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] } diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index 98c89f8a7..ad41c323c 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -9,7 +9,7 @@ // spell-checker:ignore (ToDO) ttyname filedesc -use clap::{crate_version, Arg, Command}; +use clap::{crate_version, Arg, ArgAction, Command}; use std::io::Write; use std::os::unix::io::AsRawFd; use uucore::error::{set_exit_code, UResult}; @@ -26,7 +26,7 @@ mod options { pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = uu_app().get_matches_from(args); - let silent = matches.contains_id(options::SILENT); + let silent = matches.get_flag(options::SILENT); // If silent, we don't need the name, only whether or not stdin is a tty. if silent { @@ -59,7 +59,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { Ok(()) } -pub fn uu_app<'a>() -> Command<'a> { +pub fn uu_app() -> Command { Command::new(uucore::util_name()) .version(crate_version!()) .about(ABOUT) @@ -71,6 +71,6 @@ pub fn uu_app<'a>() -> Command<'a> { .visible_alias("quiet") .short('s') .help("print nothing, only return an exit status") - .required(false), + .action(ArgAction::SetTrue), ) }