1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-17 04:06:18 +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" path = "src/runcon.rs"
[dependencies] [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 = { version = ">=0.0.9", package="uucore", path="../../uucore", features=["entries", "fs", "perms"] }
uucore_procs = { version = ">=0.0.6", package="uucore_procs", path="../../uucore_procs" } uucore_procs = { version = ">=0.0.6", package="uucore_procs", path="../../uucore_procs" }
selinux = { version = "0.2" } 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()) App::new(uucore::util_name())
.version(VERSION) .version(VERSION)
.about(ABOUT) .about(ABOUT)
.after_help(DESCRIPTION) .after_help(DESCRIPTION)
.arg( .arg(
Arg::with_name(options::COMPUTE) Arg::new(options::COMPUTE)
.short("c") .short('c')
.long(options::COMPUTE) .long(options::COMPUTE)
.takes_value(false) .takes_value(false)
.help("Compute process transition context before modifying."), .help("Compute process transition context before modifying."),
) )
.arg( .arg(
Arg::with_name(options::USER) Arg::new(options::USER)
.short("u") .short('u')
.long(options::USER) .long(options::USER)
.takes_value(true) .takes_value(true)
.value_name("USER") .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(
Arg::with_name(options::ROLE) Arg::new(options::ROLE)
.short("r") .short('r')
.long(options::ROLE) .long(options::ROLE)
.takes_value(true) .takes_value(true)
.value_name("ROLE") .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(
Arg::with_name(options::TYPE) Arg::new(options::TYPE)
.short("t") .short('t')
.long(options::TYPE) .long(options::TYPE)
.takes_value(true) .takes_value(true)
.value_name("TYPE") .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(
Arg::with_name(options::RANGE) Arg::new(options::RANGE)
.short("l") .short('l')
.long(options::RANGE) .long(options::RANGE)
.takes_value(true) .takes_value(true)
.value_name("RANGE") .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. // Once "ARG" is parsed, everything after that belongs to it.
// //
// This is not how POSIX does things, but this is how the GNU implementation // This is not how POSIX does things, but this is how the GNU implementation