mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
sum: update to clap 4
This commit is contained in:
parent
5722e47474
commit
02f6d4d5c8
2 changed files with 9 additions and 7 deletions
|
@ -15,7 +15,7 @@ edition = "2021"
|
|||
path = "src/sum.rs"
|
||||
|
||||
[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" }
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
use clap::{crate_version, Arg, Command};
|
||||
use clap::{crate_version, Arg, ArgAction, Command};
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, Read};
|
||||
use std::path::Path;
|
||||
|
@ -118,7 +118,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
None => vec!["-".to_owned()],
|
||||
};
|
||||
|
||||
let sysv = matches.contains_id(options::SYSTEM_V_COMPATIBLE);
|
||||
let sysv = matches.get_flag(options::SYSTEM_V_COMPATIBLE);
|
||||
|
||||
let print_names = if sysv {
|
||||
files.len() > 1 || files[0] != "-"
|
||||
|
@ -149,7 +149,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app<'a>() -> Command<'a> {
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.name(NAME)
|
||||
.version(crate_version!())
|
||||
|
@ -158,19 +158,21 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.multiple_occurrences(true)
|
||||
.action(ArgAction::Append)
|
||||
.hide(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::BSD_COMPATIBLE)
|
||||
.short('r')
|
||||
.help("use the BSD sum algorithm, use 1K blocks (default)"),
|
||||
.help("use the BSD sum algorithm, use 1K blocks (default)")
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::SYSTEM_V_COMPATIBLE)
|
||||
.short('s')
|
||||
.long(options::SYSTEM_V_COMPATIBLE)
|
||||
.help("use System V sum algorithm, use 512 bytes blocks"),
|
||||
.help("use System V sum algorithm, use 512 bytes blocks")
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue