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

fold: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 13:32:15 +01:00
parent e3e35cb1a9
commit ebe96f1454
2 changed files with 14 additions and 10 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/fold.rs"
[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_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }

View file

@ -63,16 +63,16 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
fold(files, bytes, spaces, width)
}
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(SYNTAX)
.override_usage(SYNTAX)
.about(SUMMARY)
.arg(
Arg::with_name(options::BYTES)
Arg::new(options::BYTES)
.long(options::BYTES)
.short("b")
.short('b')
.help(
"count using bytes rather than columns (meaning control characters \
such as newline are not treated specially)",
@ -80,22 +80,26 @@ pub fn uu_app() -> App<'static, 'static> {
.takes_value(false),
)
.arg(
Arg::with_name(options::SPACES)
Arg::new(options::SPACES)
.long(options::SPACES)
.short("s")
.short('s')
.help("break lines at word boundaries rather than a hard cut-off")
.takes_value(false),
)
.arg(
Arg::with_name(options::WIDTH)
Arg::new(options::WIDTH)
.long(options::WIDTH)
.short("w")
.short('w')
.help("set WIDTH as the maximum line width rather than 80")
.value_name("WIDTH")
.allow_hyphen_values(true)
.takes_value(true),
)
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true))
.arg(
Arg::new(options::FILE)
.hide(true)
.multiple_occurrences(true),
)
}
fn handle_obsolete(args: &[String]) -> (Vec<String>, Option<String>) {