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

more: update to clap 4

This commit is contained in:
Terts Diepraam 2022-09-29 22:44:28 +02:00
parent 1e9e790b7c
commit ca135d3ef3
2 changed files with 7 additions and 6 deletions

View file

@ -15,7 +15,7 @@ edition = "2021"
path = "src/more.rs" path = "src/more.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" }
crossterm = ">=0.19" crossterm = ">=0.19"
atty = "0.2" atty = "0.2"

View file

@ -17,7 +17,7 @@ use std::{
#[cfg(all(unix, not(target_os = "fuchsia")))] #[cfg(all(unix, not(target_os = "fuchsia")))]
extern crate nix; extern crate nix;
use clap::{crate_version, Arg, Command}; use clap::{crate_version, Arg, ArgAction, Command};
use crossterm::event::KeyEventKind; use crossterm::event::KeyEventKind;
use crossterm::{ use crossterm::{
event::{self, Event, KeyCode, KeyEvent, KeyModifiers}, event::{self, Event, KeyCode, KeyEvent, KeyModifiers},
@ -55,7 +55,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().get_matches_from(args); let matches = uu_app().get_matches_from(args);
let mut buff = String::new(); let mut buff = String::new();
let silent = matches.contains_id(options::SILENT); let silent = matches.get_flag(options::SILENT);
if let Some(files) = matches.get_many::<String>(options::FILES) { if let Some(files) = matches.get_many::<String>(options::FILES) {
let mut stdout = setup_term(); let mut stdout = setup_term();
let length = files.len(); let length = files.len();
@ -97,7 +97,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(()) Ok(())
} }
pub fn uu_app<'a>() -> Command<'a> { pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.about("A file perusal filter for CRT viewing.") .about("A file perusal filter for CRT viewing.")
.version(crate_version!()) .version(crate_version!())
@ -106,7 +106,8 @@ pub fn uu_app<'a>() -> Command<'a> {
Arg::new(options::SILENT) Arg::new(options::SILENT)
.short('d') .short('d')
.long(options::SILENT) .long(options::SILENT)
.help("Display help instead of ringing bell"), .help("Display help instead of ringing bell")
.action(ArgAction::SetTrue),
) )
// The commented arguments below are unimplemented: // The commented arguments below are unimplemented:
/* /*
@ -183,7 +184,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.arg( .arg(
Arg::new(options::FILES) Arg::new(options::FILES)
.required(false) .required(false)
.multiple_occurrences(true) .action(ArgAction::Append)
.help("Path to the files to be read") .help("Path to the files to be read")
.value_hint(clap::ValueHint::FilePath), .value_hint(clap::ValueHint::FilePath),
) )