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

tail: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 15:01:43 +01:00
parent 219498c2e8
commit 9c9643807a
2 changed files with 20 additions and 20 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/tail.rs" path = "src/tail.rs"
[dependencies] [dependencies]
clap = { version = "2.33", features = ["wrap_help"] } clap = { version = "3.0", features = ["wrap_help", "cargo"] }
libc = "0.2.42" libc = "0.2.42"
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["ringbuffer"] } uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["ringbuffer"] }
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

@ -271,14 +271,14 @@ fn arg_iterate<'a>(
} }
} }
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)
.usage(USAGE) .override_usage(USAGE)
.arg( .arg(
Arg::with_name(options::BYTES) Arg::new(options::BYTES)
.short("c") .short('c')
.long(options::BYTES) .long(options::BYTES)
.takes_value(true) .takes_value(true)
.allow_hyphen_values(true) .allow_hyphen_values(true)
@ -286,14 +286,14 @@ pub fn uu_app() -> App<'static, 'static> {
.help("Number of bytes to print"), .help("Number of bytes to print"),
) )
.arg( .arg(
Arg::with_name(options::FOLLOW) Arg::new(options::FOLLOW)
.short("f") .short('f')
.long(options::FOLLOW) .long(options::FOLLOW)
.help("Print the file as it grows"), .help("Print the file as it grows"),
) )
.arg( .arg(
Arg::with_name(options::LINES) Arg::new(options::LINES)
.short("n") .short('n')
.long(options::LINES) .long(options::LINES)
.takes_value(true) .takes_value(true)
.allow_hyphen_values(true) .allow_hyphen_values(true)
@ -301,42 +301,42 @@ pub fn uu_app() -> App<'static, 'static> {
.help("Number of lines to print"), .help("Number of lines to print"),
) )
.arg( .arg(
Arg::with_name(options::PID) Arg::new(options::PID)
.long(options::PID) .long(options::PID)
.takes_value(true) .takes_value(true)
.help("with -f, terminate after process ID, PID dies"), .help("with -f, terminate after process ID, PID dies"),
) )
.arg( .arg(
Arg::with_name(options::verbosity::QUIET) Arg::new(options::verbosity::QUIET)
.short("q") .short('q')
.long(options::verbosity::QUIET) .long(options::verbosity::QUIET)
.visible_alias("silent") .visible_alias("silent")
.overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE]) .overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE])
.help("never output headers giving file names"), .help("never output headers giving file names"),
) )
.arg( .arg(
Arg::with_name(options::SLEEP_INT) Arg::new(options::SLEEP_INT)
.short("s") .short('s')
.takes_value(true) .takes_value(true)
.long(options::SLEEP_INT) .long(options::SLEEP_INT)
.help("Number or seconds to sleep between polling the file when running with -f"), .help("Number or seconds to sleep between polling the file when running with -f"),
) )
.arg( .arg(
Arg::with_name(options::verbosity::VERBOSE) Arg::new(options::verbosity::VERBOSE)
.short("v") .short('v')
.long(options::verbosity::VERBOSE) .long(options::verbosity::VERBOSE)
.overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE]) .overrides_with_all(&[options::verbosity::QUIET, options::verbosity::VERBOSE])
.help("always output headers giving file names"), .help("always output headers giving file names"),
) )
.arg( .arg(
Arg::with_name(options::ZERO_TERM) Arg::new(options::ZERO_TERM)
.short("z") .short('z')
.long(options::ZERO_TERM) .long(options::ZERO_TERM)
.help("Line delimiter is NUL, not newline"), .help("Line delimiter is NUL, not newline"),
) )
.arg( .arg(
Arg::with_name(options::ARG_FILES) Arg::new(options::ARG_FILES)
.multiple(true) .multiple_occurrences(true)
.takes_value(true) .takes_value(true)
.min_values(1), .min_values(1),
) )