mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
pinky: clap 3
This commit is contained in:
parent
49b19972cc
commit
c39a9b49d4
3 changed files with 24 additions and 24 deletions
|
@ -17,7 +17,7 @@ path = "src/pinky.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["utmpx", "entries"] }
|
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["utmpx", "entries"] }
|
||||||
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
||||||
clap = { version = "2.33", features = ["wrap_help"] }
|
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "pinky"
|
name = "pinky"
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let after_help = get_long_usage();
|
let after_help = get_long_usage();
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -132,60 +132,60 @@ 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(crate_version!())
|
.version(crate_version!())
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::LONG_FORMAT)
|
Arg::new(options::LONG_FORMAT)
|
||||||
.short("l")
|
.short('l')
|
||||||
.requires(options::USER)
|
.requires(options::USER)
|
||||||
.help("produce long format output for the specified USERs"),
|
.help("produce long format output for the specified USERs"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OMIT_HOME_DIR)
|
Arg::new(options::OMIT_HOME_DIR)
|
||||||
.short("b")
|
.short('b')
|
||||||
.help("omit the user's home directory and shell in long format"),
|
.help("omit the user's home directory and shell in long format"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OMIT_PROJECT_FILE)
|
Arg::new(options::OMIT_PROJECT_FILE)
|
||||||
.short("h")
|
.short('h')
|
||||||
.help("omit the user's project file in long format"),
|
.help("omit the user's project file in long format"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OMIT_PLAN_FILE)
|
Arg::new(options::OMIT_PLAN_FILE)
|
||||||
.short("p")
|
.short('p')
|
||||||
.help("omit the user's plan file in long format"),
|
.help("omit the user's plan file in long format"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::SHORT_FORMAT)
|
Arg::new(options::SHORT_FORMAT)
|
||||||
.short("s")
|
.short('s')
|
||||||
.help("do short format output, this is the default"),
|
.help("do short format output, this is the default"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OMIT_HEADINGS)
|
Arg::new(options::OMIT_HEADINGS)
|
||||||
.short("f")
|
.short('f')
|
||||||
.help("omit the line of column headings in short format"),
|
.help("omit the line of column headings in short format"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OMIT_NAME)
|
Arg::new(options::OMIT_NAME)
|
||||||
.short("w")
|
.short('w')
|
||||||
.help("omit the user's full name in short format"),
|
.help("omit the user's full name in short format"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OMIT_NAME_HOST)
|
Arg::new(options::OMIT_NAME_HOST)
|
||||||
.short("i")
|
.short('i')
|
||||||
.help("omit the user's full name and remote host in short format"),
|
.help("omit the user's full name and remote host in short format"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::OMIT_NAME_HOST_TIME)
|
Arg::new(options::OMIT_NAME_HOST_TIME)
|
||||||
.short("q")
|
.short('q')
|
||||||
.help("omit the user's full name, remote host and idle time in short format"),
|
.help("omit the user's full name, remote host and idle time in short format"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::USER)
|
Arg::new(options::USER)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.multiple(true),
|
.multiple_occurrences(true),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ fn test_long_format_multiple_users() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_long_format_wo_user() {
|
fn test_long_format_wo_user() {
|
||||||
// "no username specified; at least one must be specified when using -l"
|
// "no username specified; at least one must be specified when using -l"
|
||||||
new_ucmd!().arg("-l").fails().code_is(1);
|
new_ucmd!().arg("-l").fails();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue