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

head: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 13:42:08 +01:00
parent 6e34d8a53c
commit 9fc9fdb1f3
2 changed files with 14 additions and 14 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/head.rs"
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
memchr = "2"
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["ringbuffer"] }
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }

View file

@ -42,14 +42,14 @@ use lines::zlines;
use take::take_all_but;
use take::take_lines;
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.usage(USAGE)
.override_usage(USAGE)
.arg(
Arg::with_name(options::BYTES_NAME)
.short("c")
Arg::new(options::BYTES_NAME)
.short('c')
.long("bytes")
.value_name("[-]NUM")
.takes_value(true)
@ -64,8 +64,8 @@ pub fn uu_app() -> App<'static, 'static> {
.allow_hyphen_values(true),
)
.arg(
Arg::with_name(options::LINES_NAME)
.short("n")
Arg::new(options::LINES_NAME)
.short('n')
.long("lines")
.value_name("[-]NUM")
.takes_value(true)
@ -80,28 +80,28 @@ pub fn uu_app() -> App<'static, 'static> {
.allow_hyphen_values(true),
)
.arg(
Arg::with_name(options::QUIET_NAME)
.short("q")
Arg::new(options::QUIET_NAME)
.short('q')
.long("quiet")
.visible_alias("silent")
.help("never print headers giving file names")
.overrides_with_all(&[options::VERBOSE_NAME, options::QUIET_NAME]),
)
.arg(
Arg::with_name(options::VERBOSE_NAME)
.short("v")
Arg::new(options::VERBOSE_NAME)
.short('v')
.long("verbose")
.help("always print headers giving file names")
.overrides_with_all(&[options::QUIET_NAME, options::VERBOSE_NAME]),
)
.arg(
Arg::with_name(options::ZERO_NAME)
.short("z")
Arg::new(options::ZERO_NAME)
.short('z')
.long("zero-terminated")
.help("line delimiter is NUL, not newline")
.overrides_with(options::ZERO_NAME),
)
.arg(Arg::with_name(options::FILES_NAME).multiple(true))
.arg(Arg::new(options::FILES_NAME).multiple_occurrences(true))
}
#[derive(PartialEq, Debug, Clone, Copy)]
enum Modes {