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

nl: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 14:14:12 +01:00
parent 64f57a9200
commit 5b13ec9c66
2 changed files with 30 additions and 26 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/nl.rs"
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
aho-corasick = "0.7.3"
libc = "0.2.42"
memchr = "2.2.0"

View file

@ -140,84 +140,88 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(())
}
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.name(NAME)
.version(crate_version!())
.usage(USAGE)
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true))
.override_usage(USAGE)
.arg(
Arg::with_name(options::BODY_NUMBERING)
.short("b")
Arg::new(options::FILE)
.hide(true)
.multiple_occurrences(true),
)
.arg(
Arg::new(options::BODY_NUMBERING)
.short('b')
.long(options::BODY_NUMBERING)
.help("use STYLE for numbering body lines")
.value_name("SYNTAX"),
)
.arg(
Arg::with_name(options::SECTION_DELIMITER)
.short("d")
Arg::new(options::SECTION_DELIMITER)
.short('d')
.long(options::SECTION_DELIMITER)
.help("use CC for separating logical pages")
.value_name("CC"),
)
.arg(
Arg::with_name(options::FOOTER_NUMBERING)
.short("f")
Arg::new(options::FOOTER_NUMBERING)
.short('f')
.long(options::FOOTER_NUMBERING)
.help("use STYLE for numbering footer lines")
.value_name("STYLE"),
)
.arg(
Arg::with_name(options::HEADER_NUMBERING)
.short("h")
Arg::new(options::HEADER_NUMBERING)
.short('h')
.long(options::HEADER_NUMBERING)
.help("use STYLE for numbering header lines")
.value_name("STYLE"),
)
.arg(
Arg::with_name(options::LINE_INCREMENT)
.short("i")
Arg::new(options::LINE_INCREMENT)
.short('i')
.long(options::LINE_INCREMENT)
.help("line number increment at each line")
.value_name("NUMBER"),
)
.arg(
Arg::with_name(options::JOIN_BLANK_LINES)
.short("l")
Arg::new(options::JOIN_BLANK_LINES)
.short('l')
.long(options::JOIN_BLANK_LINES)
.help("group of NUMBER empty lines counted as one")
.value_name("NUMBER"),
)
.arg(
Arg::with_name(options::NUMBER_FORMAT)
.short("n")
Arg::new(options::NUMBER_FORMAT)
.short('n')
.long(options::NUMBER_FORMAT)
.help("insert line numbers according to FORMAT")
.value_name("FORMAT"),
)
.arg(
Arg::with_name(options::NO_RENUMBER)
.short("p")
Arg::new(options::NO_RENUMBER)
.short('p')
.long(options::NO_RENUMBER)
.help("do not reset line numbers at logical pages"),
)
.arg(
Arg::with_name(options::NUMBER_SEPARATOR)
.short("s")
Arg::new(options::NUMBER_SEPARATOR)
.short('s')
.long(options::NUMBER_SEPARATOR)
.help("add STRING after (possible) line number")
.value_name("STRING"),
)
.arg(
Arg::with_name(options::STARTING_LINE_NUMBER)
.short("v")
Arg::new(options::STARTING_LINE_NUMBER)
.short('v')
.long(options::STARTING_LINE_NUMBER)
.help("first line number on each logical page")
.value_name("NUMBER"),
)
.arg(
Arg::with_name(options::NUMBER_WIDTH)
.short("w")
Arg::new(options::NUMBER_WIDTH)
.short('w')
.long(options::NUMBER_WIDTH)
.help("use NUMBER columns for line numbers")
.value_name("NUMBER"),