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

tac: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 15:01:07 +01:00
parent 57361292aa
commit 219498c2e8
2 changed files with 14 additions and 10 deletions

View file

@ -20,7 +20,7 @@ path = "src/tac.rs"
memchr = "2" memchr = "2"
memmap2 = "0.5" memmap2 = "0.5"
regex = "1" regex = "1"
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

@ -60,34 +60,38 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
tac(files, before, regex, separator) tac(files, before, regex, separator)
} }
pub fn uu_app() -> App<'static, 'static> { pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name()) App::new(uucore::util_name())
.name(NAME) .name(NAME)
.version(crate_version!()) .version(crate_version!())
.usage(USAGE) .override_usage(USAGE)
.about(SUMMARY) .about(SUMMARY)
.arg( .arg(
Arg::with_name(options::BEFORE) Arg::new(options::BEFORE)
.short("b") .short('b')
.long(options::BEFORE) .long(options::BEFORE)
.help("attach the separator before instead of after") .help("attach the separator before instead of after")
.takes_value(false), .takes_value(false),
) )
.arg( .arg(
Arg::with_name(options::REGEX) Arg::new(options::REGEX)
.short("r") .short('r')
.long(options::REGEX) .long(options::REGEX)
.help("interpret the sequence as a regular expression") .help("interpret the sequence as a regular expression")
.takes_value(false), .takes_value(false),
) )
.arg( .arg(
Arg::with_name(options::SEPARATOR) Arg::new(options::SEPARATOR)
.short("s") .short('s')
.long(options::SEPARATOR) .long(options::SEPARATOR)
.help("use STRING as the separator instead of newline") .help("use STRING as the separator instead of newline")
.takes_value(true), .takes_value(true),
) )
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true)) .arg(
Arg::new(options::FILE)
.hide(true)
.multiple_occurrences(true),
)
} }
/// Print lines of a buffer in reverse, with line separator given as a regex. /// Print lines of a buffer in reverse, with line separator given as a regex.