1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 04:27:45 +00:00

runcon: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 14:43:29 +01:00
parent 4edab26dcc
commit ec42e824f0
2 changed files with 25 additions and 17 deletions

View file

@ -14,7 +14,7 @@ edition = "2018"
path = "src/runcon.rs"
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
uucore = { version = ">=0.0.9", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] }
uucore_procs = { version = ">=0.0.6", package="uucore_procs", path="../../uucore_procs" }
selinux = { version = "0.2" }

View file

@ -109,51 +109,59 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
}
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(VERSION)
.about(ABOUT)
.after_help(DESCRIPTION)
.arg(
Arg::with_name(options::COMPUTE)
.short("c")
Arg::new(options::COMPUTE)
.short('c')
.long(options::COMPUTE)
.takes_value(false)
.help("Compute process transition context before modifying."),
)
.arg(
Arg::with_name(options::USER)
.short("u")
Arg::new(options::USER)
.short('u')
.long(options::USER)
.takes_value(true)
.value_name("USER")
.help("Set user USER in the target security context."),
.help("Set user USER in the target security context.")
.allow_invalid_utf8(true),
)
.arg(
Arg::with_name(options::ROLE)
.short("r")
Arg::new(options::ROLE)
.short('r')
.long(options::ROLE)
.takes_value(true)
.value_name("ROLE")
.help("Set role ROLE in the target security context."),
.help("Set role ROLE in the target security context.")
.allow_invalid_utf8(true),
)
.arg(
Arg::with_name(options::TYPE)
.short("t")
Arg::new(options::TYPE)
.short('t')
.long(options::TYPE)
.takes_value(true)
.value_name("TYPE")
.help("Set type TYPE in the target security context."),
.help("Set type TYPE in the target security context.")
.allow_invalid_utf8(true),
)
.arg(
Arg::with_name(options::RANGE)
.short("l")
Arg::new(options::RANGE)
.short('l')
.long(options::RANGE)
.takes_value(true)
.value_name("RANGE")
.help("Set range RANGE in the target security context."),
.help("Set range RANGE in the target security context.")
.allow_invalid_utf8(true),
)
.arg(
Arg::new("ARG")
.multiple_occurrences(true)
.allow_invalid_utf8(true),
)
.arg(Arg::with_name("ARG").multiple(true))
// Once "ARG" is parsed, everything after that belongs to it.
//
// This is not how POSIX does things, but this is how the GNU implementation