1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

join: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 13:49:25 +01:00
parent 89112fb1c2
commit b61494337e
2 changed files with 29 additions and 31 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/join.rs"
[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" }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }

View file

@ -532,7 +532,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
exec(file1, file2, settings)
}
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
App::new(NAME)
.version(crate_version!())
.about(
@ -541,12 +541,10 @@ standard output. The default join field is the first, delimited by blanks.
When FILE1 or FILE2 (not both) is -, read standard input.",
)
.help_message("display this help and exit")
.version_message("display version and exit")
.arg(
Arg::with_name("a")
.short("a")
.multiple(true)
Arg::new("a")
.short('a')
.multiple_occurrences(true)
.number_of_values(1)
.possible_values(&["1", "2"])
.value_name("FILENUM")
@ -556,86 +554,86 @@ FILENUM is 1 or 2, corresponding to FILE1 or FILE2",
),
)
.arg(
Arg::with_name("v")
.short("v")
.multiple(true)
Arg::new("v")
.short('v')
.multiple_occurrences(true)
.number_of_values(1)
.possible_values(&["1", "2"])
.value_name("FILENUM")
.help("like -a FILENUM, but suppress joined output lines"),
)
.arg(
Arg::with_name("e")
.short("e")
Arg::new("e")
.short('e')
.takes_value(true)
.value_name("EMPTY")
.help("replace missing input fields with EMPTY"),
)
.arg(
Arg::with_name("i")
.short("i")
Arg::new("i")
.short('i')
.long("ignore-case")
.help("ignore differences in case when comparing fields"),
)
.arg(
Arg::with_name("j")
.short("j")
Arg::new("j")
.short('j')
.takes_value(true)
.value_name("FIELD")
.help("equivalent to '-1 FIELD -2 FIELD'"),
)
.arg(
Arg::with_name("o")
.short("o")
Arg::new("o")
.short('o')
.takes_value(true)
.value_name("FORMAT")
.help("obey FORMAT while constructing output line"),
)
.arg(
Arg::with_name("t")
.short("t")
Arg::new("t")
.short('t')
.takes_value(true)
.value_name("CHAR")
.help("use CHAR as input and output field separator"),
)
.arg(
Arg::with_name("1")
.short("1")
Arg::new("1")
.short('1')
.takes_value(true)
.value_name("FIELD")
.help("join on this FIELD of file 1"),
)
.arg(
Arg::with_name("2")
.short("2")
Arg::new("2")
.short('2')
.takes_value(true)
.value_name("FIELD")
.help("join on this FIELD of file 2"),
)
.arg(Arg::with_name("check-order").long("check-order").help(
.arg(Arg::new("check-order").long("check-order").help(
"check that the input is correctly sorted, \
even if all input lines are pairable",
))
.arg(
Arg::with_name("nocheck-order")
Arg::new("nocheck-order")
.long("nocheck-order")
.help("do not check that the input is correctly sorted"),
)
.arg(Arg::with_name("header").long("header").help(
.arg(Arg::new("header").long("header").help(
"treat the first line in each file as field headers, \
print them without trying to pair them",
))
.arg(
Arg::with_name("file1")
Arg::new("file1")
.required(true)
.value_name("FILE1")
.hidden(true),
.hide(true),
)
.arg(
Arg::with_name("file2")
Arg::new("file2")
.required(true)
.value_name("FILE2")
.hidden(true),
.hide(true),
)
}