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

Merge pull request #3885 from cakebaker/clap_replace_forbid_empty_values

Replace forbid_empty_values() with value_parser()
This commit is contained in:
Sylvestre Ledru 2022-08-29 12:14:30 +02:00 committed by GitHub
commit 5fb5a26425
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,7 +10,7 @@
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
use clap::{crate_version, Arg, ArgMatches, Command}; use clap::{builder::NonEmptyStringValueParser, crate_version, Arg, ArgMatches, Command};
use std::{ use std::{
io::{stdout, Write}, io::{stdout, Write},
path::{Path, PathBuf}, path::{Path, PathBuf},
@ -150,7 +150,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.long(OPT_RELATIVE_TO) .long(OPT_RELATIVE_TO)
.takes_value(true) .takes_value(true)
.value_name("DIR") .value_name("DIR")
.forbid_empty_values(true) .value_parser(NonEmptyStringValueParser::new())
.help("print the resolved path relative to DIR"), .help("print the resolved path relative to DIR"),
) )
.arg( .arg(
@ -158,14 +158,14 @@ pub fn uu_app<'a>() -> Command<'a> {
.long(OPT_RELATIVE_BASE) .long(OPT_RELATIVE_BASE)
.takes_value(true) .takes_value(true)
.value_name("DIR") .value_name("DIR")
.forbid_empty_values(true) .value_parser(NonEmptyStringValueParser::new())
.help("print absolute paths unless paths below DIR"), .help("print absolute paths unless paths below DIR"),
) )
.arg( .arg(
Arg::new(ARG_FILES) Arg::new(ARG_FILES)
.multiple_occurrences(true) .multiple_occurrences(true)
.required(true) .required(true)
.forbid_empty_values(true) .value_parser(NonEmptyStringValueParser::new())
.value_hint(clap::ValueHint::AnyPath), .value_hint(clap::ValueHint::AnyPath),
) )
} }