mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
id: clap 3
This commit is contained in:
parent
82aadbf38f
commit
8c58f8e2b1
2 changed files with 25 additions and 25 deletions
|
@ -15,7 +15,7 @@ edition = "2018"
|
||||||
path = "src/id.rs"
|
path = "src/id.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "2.33", features = ["wrap_help"] }
|
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
|
||||||
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["entries", "process"] }
|
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["entries", "process"] }
|
||||||
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
||||||
selinux = { version="0.2.1", optional = true }
|
selinux = { version="0.2.1", optional = true }
|
||||||
|
|
|
@ -132,7 +132,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let after_help = get_description();
|
let after_help = get_description();
|
||||||
|
|
||||||
let matches = uu_app()
|
let matches = uu_app()
|
||||||
.usage(&usage[..])
|
.override_usage(&usage[..])
|
||||||
.after_help(&after_help[..])
|
.after_help(&after_help[..])
|
||||||
.get_matches_from(args);
|
.get_matches_from(args);
|
||||||
|
|
||||||
|
@ -347,13 +347,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app() -> App<'static, 'static> {
|
pub fn uu_app<'a>() -> App<'a> {
|
||||||
App::new(uucore::util_name())
|
App::new(uucore::util_name())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_AUDIT)
|
Arg::new(options::OPT_AUDIT)
|
||||||
.short("A")
|
.short('A')
|
||||||
.conflicts_with_all(&[
|
.conflicts_with_all(&[
|
||||||
options::OPT_GROUP,
|
options::OPT_GROUP,
|
||||||
options::OPT_EFFECTIVE_USER,
|
options::OPT_EFFECTIVE_USER,
|
||||||
|
@ -368,22 +368,22 @@ pub fn uu_app() -> App<'static, 'static> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_EFFECTIVE_USER)
|
Arg::new(options::OPT_EFFECTIVE_USER)
|
||||||
.short("u")
|
.short('u')
|
||||||
.long(options::OPT_EFFECTIVE_USER)
|
.long(options::OPT_EFFECTIVE_USER)
|
||||||
.conflicts_with(options::OPT_GROUP)
|
.conflicts_with(options::OPT_GROUP)
|
||||||
.help("Display only the effective user ID as a number."),
|
.help("Display only the effective user ID as a number."),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_GROUP)
|
Arg::new(options::OPT_GROUP)
|
||||||
.short("g")
|
.short('g')
|
||||||
.long(options::OPT_GROUP)
|
.long(options::OPT_GROUP)
|
||||||
.conflicts_with(options::OPT_EFFECTIVE_USER)
|
.conflicts_with(options::OPT_EFFECTIVE_USER)
|
||||||
.help("Display only the effective group ID as a number"),
|
.help("Display only the effective group ID as a number"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_GROUPS)
|
Arg::new(options::OPT_GROUPS)
|
||||||
.short("G")
|
.short('G')
|
||||||
.long(options::OPT_GROUPS)
|
.long(options::OPT_GROUPS)
|
||||||
.conflicts_with_all(&[
|
.conflicts_with_all(&[
|
||||||
options::OPT_GROUP,
|
options::OPT_GROUP,
|
||||||
|
@ -399,13 +399,13 @@ pub fn uu_app() -> App<'static, 'static> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_HUMAN_READABLE)
|
Arg::new(options::OPT_HUMAN_READABLE)
|
||||||
.short("p")
|
.short('p')
|
||||||
.help("Make the output human-readable. Each display is on a separate line."),
|
.help("Make the output human-readable. Each display is on a separate line."),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_NAME)
|
Arg::new(options::OPT_NAME)
|
||||||
.short("n")
|
.short('n')
|
||||||
.long(options::OPT_NAME)
|
.long(options::OPT_NAME)
|
||||||
.help(
|
.help(
|
||||||
"Display the name of the user or group ID for the -G, -g and -u options \
|
"Display the name of the user or group ID for the -G, -g and -u options \
|
||||||
|
@ -414,13 +414,13 @@ pub fn uu_app() -> App<'static, 'static> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_PASSWORD)
|
Arg::new(options::OPT_PASSWORD)
|
||||||
.short("P")
|
.short('P')
|
||||||
.help("Display the id as a password file entry."),
|
.help("Display the id as a password file entry."),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_REAL_ID)
|
Arg::new(options::OPT_REAL_ID)
|
||||||
.short("r")
|
.short('r')
|
||||||
.long(options::OPT_REAL_ID)
|
.long(options::OPT_REAL_ID)
|
||||||
.help(
|
.help(
|
||||||
"Display the real ID for the -G, -g and -u options instead of \
|
"Display the real ID for the -G, -g and -u options instead of \
|
||||||
|
@ -428,8 +428,8 @@ pub fn uu_app() -> App<'static, 'static> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_ZERO)
|
Arg::new(options::OPT_ZERO)
|
||||||
.short("z")
|
.short('z')
|
||||||
.long(options::OPT_ZERO)
|
.long(options::OPT_ZERO)
|
||||||
.help(
|
.help(
|
||||||
"delimit entries with NUL characters, not whitespace;\n\
|
"delimit entries with NUL characters, not whitespace;\n\
|
||||||
|
@ -437,15 +437,15 @@ pub fn uu_app() -> App<'static, 'static> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OPT_CONTEXT)
|
Arg::new(options::OPT_CONTEXT)
|
||||||
.short("Z")
|
.short('Z')
|
||||||
.long(options::OPT_CONTEXT)
|
.long(options::OPT_CONTEXT)
|
||||||
.conflicts_with_all(&[options::OPT_GROUP, options::OPT_EFFECTIVE_USER])
|
.conflicts_with_all(&[options::OPT_GROUP, options::OPT_EFFECTIVE_USER])
|
||||||
.help(CONTEXT_HELP_TEXT),
|
.help(CONTEXT_HELP_TEXT),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::ARG_USERS)
|
Arg::new(options::ARG_USERS)
|
||||||
.multiple(true)
|
.multiple_occurrences(true)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.value_name(options::ARG_USERS),
|
.value_name(options::ARG_USERS),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue