mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
seq: update to clap 4
This commit is contained in:
parent
d92f2f6195
commit
4cfc90c077
3 changed files with 13 additions and 20 deletions
|
@ -17,7 +17,7 @@ path = "src/seq.rs"
|
|||
|
||||
[dependencies]
|
||||
bigdecimal = "0.3"
|
||||
clap = { version = "3.2", features = ["wrap_help", "cargo"] }
|
||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||
num-bigint = "0.4.0"
|
||||
num-traits = "0.2.15"
|
||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["memo"] }
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use std::io::{stdout, ErrorKind, Write};
|
||||
use std::process::exit;
|
||||
|
||||
use clap::{crate_version, Arg, Command};
|
||||
use clap::{crate_version, Arg, ArgAction, Command};
|
||||
use num_traits::Zero;
|
||||
|
||||
use uucore::error::FromIo;
|
||||
|
@ -77,7 +77,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
.map(|s| s.as_str())
|
||||
.unwrap_or("\n")
|
||||
.to_string(),
|
||||
widths: matches.contains_id(OPT_WIDTHS),
|
||||
widths: matches.get_flag(OPT_WIDTHS),
|
||||
format: matches.get_one::<String>(OPT_FORMAT).map(|s| s.as_str()),
|
||||
};
|
||||
|
||||
|
@ -152,7 +152,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn uu_app<'a>() -> Command<'a> {
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.trailing_var_arg(true)
|
||||
.allow_negative_numbers(true)
|
||||
|
@ -164,38 +164,31 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(OPT_SEPARATOR)
|
||||
.short('s')
|
||||
.long("separator")
|
||||
.help("Separator character (defaults to \\n)")
|
||||
.takes_value(true)
|
||||
.number_of_values(1),
|
||||
.help("Separator character (defaults to \\n)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(OPT_TERMINATOR)
|
||||
.short('t')
|
||||
.long("terminator")
|
||||
.help("Terminator character (defaults to \\n)")
|
||||
.takes_value(true)
|
||||
.number_of_values(1),
|
||||
.help("Terminator character (defaults to \\n)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(OPT_WIDTHS)
|
||||
.short('w')
|
||||
.long("widths")
|
||||
.help("Equalize widths of all numbers by padding with zeros"),
|
||||
.help("Equalize widths of all numbers by padding with zeros")
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(OPT_FORMAT)
|
||||
.short('f')
|
||||
.long(OPT_FORMAT)
|
||||
.help("use printf style floating-point FORMAT")
|
||||
.takes_value(true)
|
||||
.number_of_values(1),
|
||||
.help("use printf style floating-point FORMAT"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(ARG_NUMBERS)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.max_values(3)
|
||||
.required(true),
|
||||
.action(ArgAction::Append)
|
||||
.num_args(1..=3),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,13 @@ fn test_hex_rejects_sign_after_identifier() {
|
|||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("which wasn't expected, or isn't valid in this context")
|
||||
.stderr_contains("For more information try --help");
|
||||
.stderr_contains("For more information try '--help'");
|
||||
new_ucmd!()
|
||||
.args(&["-0x+123ABC"])
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("which wasn't expected, or isn't valid in this context")
|
||||
.stderr_contains("For more information try --help");
|
||||
.stderr_contains("For more information try '--help'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue