1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

seq: clap 3

This commit is contained in:
Terts Diepraam 2022-01-11 14:44:10 +01:00
parent ec42e824f0
commit 41513a8ba6
2 changed files with 13 additions and 13 deletions

View file

@ -17,7 +17,7 @@ path = "src/seq.rs"
[dependencies]
bigdecimal = "0.3"
clap = { version = "2.33", features = ["wrap_help"] }
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
num-bigint = "0.4.0"
num-traits = "0.2.14"
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }

View file

@ -58,7 +58,7 @@ type RangeFloat = (ExtendedBigDecimal, ExtendedBigDecimal, ExtendedBigDecimal);
#[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
let matches = uu_app().override_usage(&usage[..]).get_matches_from(args);
let numbers = matches.values_of(ARG_NUMBERS).unwrap().collect::<Vec<_>>();
@ -137,38 +137,38 @@ 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())
.setting(AppSettings::AllowLeadingHyphen)
.setting(AppSettings::TrailingVarArg)
.setting(AppSettings::AllowHyphenValues)
.version(crate_version!())
.about(ABOUT)
.arg(
Arg::with_name(OPT_SEPARATOR)
.short("s")
Arg::new(OPT_SEPARATOR)
.short('s')
.long("separator")
.help("Separator character (defaults to \\n)")
.takes_value(true)
.number_of_values(1),
)
.arg(
Arg::with_name(OPT_TERMINATOR)
.short("t")
Arg::new(OPT_TERMINATOR)
.short('t')
.long("terminator")
.help("Terminator character (defaults to \\n)")
.takes_value(true)
.number_of_values(1),
)
.arg(
Arg::with_name(OPT_WIDTHS)
.short("w")
Arg::new(OPT_WIDTHS)
.short('w')
.long("widths")
.help("Equalize widths of all numbers by padding with zeros"),
)
.arg(
Arg::with_name(ARG_NUMBERS)
.multiple(true)
Arg::new(ARG_NUMBERS)
.multiple_occurrences(true)
.takes_value(true)
.allow_hyphen_values(true)
.max_values(3)
.required(true),
)