1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +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" path = "src/join.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" } uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" } 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) exec(file1, file2, settings)
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(NAME) App::new(NAME)
.version(crate_version!()) .version(crate_version!())
.about( .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.", 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(
Arg::with_name("a") Arg::new("a")
.short("a") .short('a')
.multiple(true) .multiple_occurrences(true)
.number_of_values(1) .number_of_values(1)
.possible_values(&["1", "2"]) .possible_values(&["1", "2"])
.value_name("FILENUM") .value_name("FILENUM")
@ -556,86 +554,86 @@ FILENUM is 1 or 2, corresponding to FILE1 or FILE2",
), ),
) )
.arg( .arg(
Arg::with_name("v") Arg::new("v")
.short("v") .short('v')
.multiple(true) .multiple_occurrences(true)
.number_of_values(1) .number_of_values(1)
.possible_values(&["1", "2"]) .possible_values(&["1", "2"])
.value_name("FILENUM") .value_name("FILENUM")
.help("like -a FILENUM, but suppress joined output lines"), .help("like -a FILENUM, but suppress joined output lines"),
) )
.arg( .arg(
Arg::with_name("e") Arg::new("e")
.short("e") .short('e')
.takes_value(true) .takes_value(true)
.value_name("EMPTY") .value_name("EMPTY")
.help("replace missing input fields with EMPTY"), .help("replace missing input fields with EMPTY"),
) )
.arg( .arg(
Arg::with_name("i") Arg::new("i")
.short("i") .short('i')
.long("ignore-case") .long("ignore-case")
.help("ignore differences in case when comparing fields"), .help("ignore differences in case when comparing fields"),
) )
.arg( .arg(
Arg::with_name("j") Arg::new("j")
.short("j") .short('j')
.takes_value(true) .takes_value(true)
.value_name("FIELD") .value_name("FIELD")
.help("equivalent to '-1 FIELD -2 FIELD'"), .help("equivalent to '-1 FIELD -2 FIELD'"),
) )
.arg( .arg(
Arg::with_name("o") Arg::new("o")
.short("o") .short('o')
.takes_value(true) .takes_value(true)
.value_name("FORMAT") .value_name("FORMAT")
.help("obey FORMAT while constructing output line"), .help("obey FORMAT while constructing output line"),
) )
.arg( .arg(
Arg::with_name("t") Arg::new("t")
.short("t") .short('t')
.takes_value(true) .takes_value(true)
.value_name("CHAR") .value_name("CHAR")
.help("use CHAR as input and output field separator"), .help("use CHAR as input and output field separator"),
) )
.arg( .arg(
Arg::with_name("1") Arg::new("1")
.short("1") .short('1')
.takes_value(true) .takes_value(true)
.value_name("FIELD") .value_name("FIELD")
.help("join on this FIELD of file 1"), .help("join on this FIELD of file 1"),
) )
.arg( .arg(
Arg::with_name("2") Arg::new("2")
.short("2") .short('2')
.takes_value(true) .takes_value(true)
.value_name("FIELD") .value_name("FIELD")
.help("join on this FIELD of file 2"), .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, \ "check that the input is correctly sorted, \
even if all input lines are pairable", even if all input lines are pairable",
)) ))
.arg( .arg(
Arg::with_name("nocheck-order") Arg::new("nocheck-order")
.long("nocheck-order") .long("nocheck-order")
.help("do not check that the input is correctly sorted"), .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, \ "treat the first line in each file as field headers, \
print them without trying to pair them", print them without trying to pair them",
)) ))
.arg( .arg(
Arg::with_name("file1") Arg::new("file1")
.required(true) .required(true)
.value_name("FILE1") .value_name("FILE1")
.hidden(true), .hide(true),
) )
.arg( .arg(
Arg::with_name("file2") Arg::new("file2")
.required(true) .required(true)
.value_name("FILE2") .value_name("FILE2")
.hidden(true), .hide(true),
) )
} }