1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-17 04:06:18 +00:00

numfmt: update to clap 4

This commit is contained in:
Terts Diepraam 2022-09-29 23:11:57 +02:00
parent d17c99a3cf
commit c99d89152a
2 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/numfmt.rs" path = "src/numfmt.rs"
[dependencies] [dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] } clap = { version = "4.0", features = ["wrap_help", "cargo"] }
uucore = { version=">=0.0.16", package="uucore", path="../../uucore" } uucore = { version=">=0.0.16", package="uucore", path="../../uucore" }
[[bin]] [[bin]]

View file

@ -9,7 +9,7 @@ use crate::errors::*;
use crate::format::format_and_print; use crate::format::format_and_print;
use crate::options::*; use crate::options::*;
use crate::units::{Result, Unit}; use crate::units::{Result, Unit};
use clap::{crate_version, Arg, ArgMatches, Command, ValueSource}; use clap::{crate_version, parser::ValueSource, Arg, ArgAction, ArgMatches, Command};
use std::io::{BufRead, Write}; use std::io::{BufRead, Write};
use units::{IEC_BASES, SI_BASES}; use units::{IEC_BASES, SI_BASES};
use uucore::display::Quotable; use uucore::display::Quotable;
@ -255,7 +255,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()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
@ -281,7 +281,6 @@ pub fn uu_app<'a>() -> Command<'a> {
Arg::new(options::FORMAT) Arg::new(options::FORMAT)
.long(options::FORMAT) .long(options::FORMAT)
.help("use printf style floating-point FORMAT; see FORMAT below for details") .help("use printf style floating-point FORMAT; see FORMAT below for details")
.takes_value(true)
.value_name("FORMAT"), .value_name("FORMAT"),
) )
.arg( .arg(
@ -330,6 +329,7 @@ pub fn uu_app<'a>() -> Command<'a> {
"print (without converting) the first N header lines; \ "print (without converting) the first N header lines; \
N defaults to 1 if not specified", N defaults to 1 if not specified",
) )
.num_args(..=1)
.value_name("N") .value_name("N")
.default_missing_value(options::HEADER_DEFAULT) .default_missing_value(options::HEADER_DEFAULT)
.hide_default_value(true), .hide_default_value(true),
@ -357,7 +357,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.arg( .arg(
Arg::new(options::NUMBER) Arg::new(options::NUMBER)
.hide(true) .hide(true)
.multiple_occurrences(true), .action(ArgAction::Append),
) )
} }