mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
users: update to clap 4
This commit is contained in:
parent
e99969b678
commit
60d51910e6
2 changed files with 7 additions and 8 deletions
|
@ -15,7 +15,7 @@ edition = "2021"
|
||||||
path = "src/users.rs"
|
path = "src/users.rs"
|
||||||
|
|
||||||
[dependencies]
|
[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"] }
|
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["utmpx"] }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
use clap::builder::ValueParser;
|
||||||
use clap::{crate_version, Arg, Command};
|
use clap::{crate_version, Arg, Command};
|
||||||
use uucore::error::UResult;
|
use uucore::error::UResult;
|
||||||
use uucore::format_usage;
|
use uucore::format_usage;
|
||||||
|
@ -31,10 +32,8 @@ If FILE is not specified, use {}. /var/log/wtmp as FILE is common.",
|
||||||
|
|
||||||
#[uucore::main]
|
#[uucore::main]
|
||||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let after_help = get_long_usage();
|
|
||||||
|
|
||||||
let matches = uu_app()
|
let matches = uu_app()
|
||||||
.after_help(&after_help[..])
|
.after_help(get_long_usage())
|
||||||
.try_get_matches_from(args)?;
|
.try_get_matches_from(args)?;
|
||||||
|
|
||||||
let files: Vec<&Path> = matches
|
let files: Vec<&Path> = matches
|
||||||
|
@ -61,7 +60,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)
|
||||||
|
@ -69,8 +68,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.infer_long_args(true)
|
.infer_long_args(true)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(ARG_FILES)
|
Arg::new(ARG_FILES)
|
||||||
.takes_value(true)
|
.num_args(1)
|
||||||
.max_values(1)
|
.value_hint(clap::ValueHint::FilePath)
|
||||||
.value_hint(clap::ValueHint::FilePath),
|
.value_parser(ValueParser::os_string()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue