1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

users: update to clap 4

This commit is contained in:
Terts Diepraam 2022-10-01 12:02:29 +02:00
parent e99969b678
commit 60d51910e6
2 changed files with 7 additions and 8 deletions

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/users.rs"
[dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] }
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["utmpx"] }
[[bin]]

View file

@ -11,6 +11,7 @@
use std::ffi::OsString;
use std::path::Path;
use clap::builder::ValueParser;
use clap::{crate_version, Arg, Command};
use uucore::error::UResult;
use uucore::format_usage;
@ -31,10 +32,8 @@ If FILE is not specified, use {}. /var/log/wtmp as FILE is common.",
#[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let after_help = get_long_usage();
let matches = uu_app()
.after_help(&after_help[..])
.after_help(get_long_usage())
.try_get_matches_from(args)?;
let files: Vec<&Path> = matches
@ -61,7 +60,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)
@ -69,8 +68,8 @@ pub fn uu_app<'a>() -> Command<'a> {
.infer_long_args(true)
.arg(
Arg::new(ARG_FILES)
.takes_value(true)
.max_values(1)
.value_hint(clap::ValueHint::FilePath),
.num_args(1)
.value_hint(clap::ValueHint::FilePath)
.value_parser(ValueParser::os_string()),
)
}