1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-18 11:11:10 +00:00

csplit: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 13:04:15 +01:00
parent 37ab05bd7a
commit 88447c2e50
2 changed files with 20 additions and 20 deletions

View file

@ -15,7 +15,7 @@ edition = "2018"
path = "src/csplit.rs"
[dependencies]
clap = { version = "2.33", features = ["wrap_help"] }
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
thiserror = "1.0"
regex = "1.0.0"
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["entries", "fs"] }

View file

@ -722,7 +722,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.collect_str(InvalidEncodingHandling::Ignore)
.accept_any();
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
// get the file to split
let file_name = matches.value_of(options::FILE).unwrap();
@ -751,60 +751,60 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
}
pub fn uu_app() -> App<'static, 'static> {
pub fn uu_app<'a>() -> App<'a> {
App::new(uucore::util_name())
.version(crate_version!())
.about(SUMMARY)
.arg(
Arg::with_name(options::SUFFIX_FORMAT)
.short("b")
Arg::new(options::SUFFIX_FORMAT)
.short('b')
.long(options::SUFFIX_FORMAT)
.value_name("FORMAT")
.help("use sprintf FORMAT instead of %02d"),
)
.arg(
Arg::with_name(options::PREFIX)
.short("f")
Arg::new(options::PREFIX)
.short('f')
.long(options::PREFIX)
.value_name("PREFIX")
.help("use PREFIX instead of 'xx'"),
)
.arg(
Arg::with_name(options::KEEP_FILES)
.short("k")
Arg::new(options::KEEP_FILES)
.short('k')
.long(options::KEEP_FILES)
.help("do not remove output files on errors"),
)
.arg(
Arg::with_name(options::SUPPRESS_MATCHED)
Arg::new(options::SUPPRESS_MATCHED)
.long(options::SUPPRESS_MATCHED)
.help("suppress the lines matching PATTERN"),
)
.arg(
Arg::with_name(options::DIGITS)
.short("n")
Arg::new(options::DIGITS)
.short('n')
.long(options::DIGITS)
.value_name("DIGITS")
.help("use specified number of digits instead of 2"),
)
.arg(
Arg::with_name(options::QUIET)
.short("s")
Arg::new(options::QUIET)
.short('s')
.long(options::QUIET)
.visible_alias("silent")
.help("do not print counts of output file sizes"),
)
.arg(
Arg::with_name(options::ELIDE_EMPTY_FILES)
.short("z")
Arg::new(options::ELIDE_EMPTY_FILES)
.short('z')
.long(options::ELIDE_EMPTY_FILES)
.help("remove empty output files"),
)
.arg(Arg::with_name(options::FILE).hidden(true).required(true))
.arg(Arg::new(options::FILE).hide(true).required(true))
.arg(
Arg::with_name(options::PATTERN)
.hidden(true)
.multiple(true)
Arg::new(options::PATTERN)
.hide(true)
.multiple_occurrences(true)
.required(true),
)
.after_help(LONG_HELP)