1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-31 13:07:46 +00:00

tty: update to clap 4

This commit is contained in:
Terts Diepraam 2022-10-01 11:44:46 +02:00
parent 1d147c03f6
commit e94ef2f8b5
2 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/tty.rs" path = "src/tty.rs"
[dependencies] [dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] } clap = { version = "4.0", features = ["wrap_help", "cargo"] }
nix = "0.25" nix = "0.25"
atty = "0.2" atty = "0.2"
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] } uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["fs"] }

View file

@ -9,7 +9,7 @@
// spell-checker:ignore (ToDO) ttyname filedesc // 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::io::Write;
use std::os::unix::io::AsRawFd; use std::os::unix::io::AsRawFd;
use uucore::error::{set_exit_code, UResult}; use uucore::error::{set_exit_code, UResult};
@ -26,7 +26,7 @@ mod options {
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().get_matches_from(args); 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, we don't need the name, only whether or not stdin is a tty.
if silent { if silent {
@ -59,7 +59,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
@ -71,6 +71,6 @@ pub fn uu_app<'a>() -> Command<'a> {
.visible_alias("quiet") .visible_alias("quiet")
.short('s') .short('s')
.help("print nothing, only return an exit status") .help("print nothing, only return an exit status")
.required(false), .action(ArgAction::SetTrue),
) )
} }