mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #3524 from tertsdiepraam/clap-value-hints
Clap value hints
This commit is contained in:
commit
0a7ff713e0
77 changed files with 240 additions and 74 deletions
|
@ -123,7 +123,12 @@ pub fn base_app<'a>(about: &'a str, usage: &'a str) -> Command<'a> {
|
|||
)
|
||||
// "multiple" arguments are used to check whether there is more than one
|
||||
// file passed in.
|
||||
.arg(Arg::new(options::FILE).index(1).multiple_occurrences(true))
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.index(1)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_input<'a>(config: &Config, stdin_ref: &'a Stdin) -> UResult<Box<dyn Read + 'a>> {
|
||||
|
|
|
@ -102,6 +102,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::NAME)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
.hide(true),
|
||||
)
|
||||
.arg(
|
||||
|
|
|
@ -249,7 +249,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::SHOW_ALL)
|
||||
|
|
|
@ -197,6 +197,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::REFERENCE)
|
||||
.takes_value(true)
|
||||
.value_name("RFILE")
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.conflicts_with_all(&[options::USER, options::ROLE, options::TYPE, options::RANGE])
|
||||
.help(
|
||||
"Use security context of RFILE, rather than specifying \
|
||||
|
@ -210,6 +211,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::USER)
|
||||
.takes_value(true)
|
||||
.value_name("USER")
|
||||
.value_hint(clap::ValueHint::Username)
|
||||
.help("Set user USER in the target security context.")
|
||||
.allow_invalid_utf8(true),
|
||||
)
|
||||
|
@ -294,6 +296,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new("FILE")
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.min_values(1)
|
||||
.allow_invalid_utf8(true),
|
||||
)
|
||||
|
|
|
@ -113,6 +113,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::REFERENCE)
|
||||
.long(options::REFERENCE)
|
||||
.value_name("RFILE")
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.help("use RFILE's group rather than specifying GROUP values")
|
||||
.takes_value(true)
|
||||
.multiple_occurrences(false),
|
||||
|
|
|
@ -157,6 +157,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::REFERENCE)
|
||||
.long("reference")
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.help("use RFILE's mode instead of MODE values"),
|
||||
)
|
||||
.arg(
|
||||
|
@ -170,7 +171,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.required_unless_present(options::MODE)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::REFERENCE)
|
||||
.help("use RFILE's owner and group rather than specifying OWNER:GROUP values")
|
||||
.value_name("RFILE")
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.min_values(1),
|
||||
)
|
||||
.arg(
|
||||
|
|
|
@ -102,6 +102,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::NEWROOT)
|
||||
.value_hint(clap::ValueHint::DirPath)
|
||||
.hide(true)
|
||||
.required(true)
|
||||
.index(1),
|
||||
|
@ -139,6 +140,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
)
|
||||
.arg(
|
||||
Arg::new(options::COMMAND)
|
||||
.value_hint(clap::ValueHint::CommandName)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true)
|
||||
.index(2),
|
||||
|
|
|
@ -150,6 +150,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -173,6 +173,14 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.default_value(options::DELIMITER_DEFAULT)
|
||||
.hide_default_value(true),
|
||||
)
|
||||
.arg(Arg::new(options::FILE_1).required(true))
|
||||
.arg(Arg::new(options::FILE_2).required(true))
|
||||
.arg(
|
||||
Arg::new(options::FILE_1)
|
||||
.required(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::FILE_2)
|
||||
.required(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -314,6 +314,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.conflicts_with(options::NO_TARGET_DIRECTORY)
|
||||
.long(options::TARGET_DIRECTORY)
|
||||
.value_name(options::TARGET_DIRECTORY)
|
||||
.value_hint(clap::ValueHint::DirPath)
|
||||
.takes_value(true)
|
||||
.validator(|s| {
|
||||
if Path::new(s).is_dir() {
|
||||
|
@ -464,7 +465,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
// END TODO
|
||||
|
||||
.arg(Arg::new(options::PATHS)
|
||||
.multiple_occurrences(true))
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::AnyPath))
|
||||
}
|
||||
|
||||
#[uucore::main]
|
||||
|
|
|
@ -797,7 +797,12 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::ELIDE_EMPTY_FILES)
|
||||
.help("remove empty output files"),
|
||||
)
|
||||
.arg(Arg::new(options::FILE).hide(true).required(true))
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.required(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::PATTERN)
|
||||
.hide(true)
|
||||
|
|
|
@ -614,6 +614,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -272,6 +272,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.short('f')
|
||||
.long(OPT_FILE)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.help("like --date; once for each line of DATEFILE"),
|
||||
)
|
||||
.arg(
|
||||
|
@ -303,6 +304,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.short('r')
|
||||
.long(OPT_REFERENCE)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
.help("display the last modification time of FILE"),
|
||||
)
|
||||
.arg(
|
||||
|
|
|
@ -742,6 +742,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::INFILE)
|
||||
.overrides_with(options::INFILE)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.require_equals(true)
|
||||
.value_name("FILE")
|
||||
.help("(alternatively if=FILE) specifies the file used for input. When not specified, stdin is used instead")
|
||||
|
@ -751,6 +752,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::OUTFILE)
|
||||
.overrides_with(options::OUTFILE)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.require_equals(true)
|
||||
.value_name("FILE")
|
||||
.help("(alternatively of=FILE) specifies the file used for output. When not specified, stdout is used instead")
|
||||
|
|
|
@ -583,7 +583,11 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.multiple_occurrences(true)
|
||||
.help("limit listing to file systems not of type TYPE"),
|
||||
)
|
||||
.arg(Arg::new(OPT_PATHS).multiple_occurrences(true))
|
||||
.arg(
|
||||
Arg::new(OPT_PATHS)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -187,6 +187,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.multiple_occurrences(true),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -88,5 +88,10 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.short('z')
|
||||
.help("separate output with NUL rather than newline"),
|
||||
)
|
||||
.arg(Arg::new(options::DIR).hide(true).multiple_occurrences(true))
|
||||
.arg(
|
||||
Arg::new(options::DIR)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -884,6 +884,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.short('X')
|
||||
.long("exclude-from")
|
||||
.value_name("FILE")
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.help("exclude files that match any pattern in FILE")
|
||||
.multiple_occurrences(true)
|
||||
|
||||
|
@ -913,6 +914,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
.multiple_occurrences(true)
|
||||
)
|
||||
}
|
||||
|
|
2
src/uu/env/src/env.rs
vendored
2
src/uu/env/src/env.rs
vendored
|
@ -144,6 +144,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.takes_value(true)
|
||||
.number_of_values(1)
|
||||
.value_name("DIR")
|
||||
.value_hint(clap::ValueHint::DirPath)
|
||||
.help("change working directory to DIR"))
|
||||
.arg(Arg::new("null")
|
||||
.short('0')
|
||||
|
@ -156,6 +157,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.takes_value(true)
|
||||
.number_of_values(1)
|
||||
.value_name("PATH")
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.multiple_occurrences(true)
|
||||
.help("read and set variables from a \".env\"-style configuration file (prior to any \
|
||||
unset and/or set)"))
|
||||
|
|
|
@ -207,6 +207,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.multiple_occurrences(true)
|
||||
.hide(true)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -344,6 +344,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(ARG_FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true),
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -99,7 +99,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::USERS)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.value_name(options::USERS),
|
||||
.value_name(options::USERS)
|
||||
.value_hint(clap::ValueHint::Username),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -423,6 +423,7 @@ pub fn uu_app_common<'a>() -> Command<'a> {
|
|||
.index(1)
|
||||
.multiple_occurrences(true)
|
||||
.value_name("FILE")
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.allow_invalid_utf8(true),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -107,7 +107,11 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.help("line delimiter is NUL, not newline")
|
||||
.overrides_with(options::ZERO_NAME),
|
||||
)
|
||||
.arg(Arg::new(options::FILES_NAME).multiple_occurrences(true))
|
||||
.arg(
|
||||
Arg::new(options::FILES_NAME)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
|
|
@ -105,7 +105,11 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.overrides_with_all(&[OPT_DOMAIN, OPT_IP_ADDRESS, OPT_FQDN, OPT_SHORT])
|
||||
.help("Display the short hostname (the portion before the first dot) if possible"),
|
||||
)
|
||||
.arg(Arg::new(OPT_HOST).allow_invalid_utf8(true))
|
||||
.arg(
|
||||
Arg::new(OPT_HOST)
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::Hostname),
|
||||
)
|
||||
}
|
||||
|
||||
fn display_hostname(matches: &ArgMatches) -> UResult<()> {
|
||||
|
|
|
@ -443,7 +443,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::ARG_USERS)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.value_name(options::ARG_USERS),
|
||||
.value_name(options::ARG_USERS)
|
||||
.value_hint(clap::ValueHint::Username),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -248,6 +248,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.help("set ownership (super-user only)")
|
||||
.value_name("OWNER")
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::Username)
|
||||
)
|
||||
.arg(
|
||||
Arg::new(OPT_PRESERVE_TIMESTAMPS)
|
||||
|
@ -266,6 +267,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(OPT_STRIP_PROGRAM)
|
||||
.help("program used to strip binaries (no action Windows)")
|
||||
.value_name("PROGRAM")
|
||||
.value_hint(clap::ValueHint::CommandName)
|
||||
)
|
||||
.arg(
|
||||
backup_control::arguments::suffix()
|
||||
|
@ -277,6 +279,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(OPT_TARGET_DIRECTORY)
|
||||
.help("move all SOURCE arguments into DIRECTORY")
|
||||
.value_name("DIRECTORY")
|
||||
.value_hint(clap::ValueHint::DirPath)
|
||||
)
|
||||
.arg(
|
||||
// TODO implement flag
|
||||
|
@ -307,7 +310,13 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.help("(unimplemented) set security context of files and directories")
|
||||
.value_name("CONTEXT")
|
||||
)
|
||||
.arg(Arg::new(ARG_FILES).multiple_occurrences(true).takes_value(true).min_values(1))
|
||||
.arg(
|
||||
Arg::new(ARG_FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.min_values(1)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
)
|
||||
}
|
||||
|
||||
/// Check for unimplemented command line arguments.
|
||||
|
|
|
@ -801,12 +801,14 @@ FILENUM is 1 or 2, corresponding to FILE1 or FILE2",
|
|||
Arg::new("file1")
|
||||
.required(true)
|
||||
.value_name("FILE1")
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.hide(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("file2")
|
||||
.required(true)
|
||||
.value_name("FILE2")
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.hide(true),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.min_values(2)
|
||||
.max_values(2)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
.allow_invalid_utf8(true),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -232,6 +232,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::TARGET_DIRECTORY)
|
||||
.help("specify the DIRECTORY in which to create the links")
|
||||
.value_name("DIRECTORY")
|
||||
.value_hint(clap::ValueHint::DirPath)
|
||||
.conflicts_with(options::NO_TARGET_DIRECTORY),
|
||||
)
|
||||
.arg(
|
||||
|
@ -257,6 +258,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(ARG_FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
.required(true)
|
||||
.min_values(1),
|
||||
)
|
||||
|
|
|
@ -1402,7 +1402,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::PATHS)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.allow_invalid_utf8(true),
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
.allow_invalid_utf8(true)
|
||||
)
|
||||
.after_help(
|
||||
"The TIME_STYLE argument can be full-iso, long-iso, iso. \
|
||||
|
|
|
@ -137,7 +137,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.min_values(1)
|
||||
.allow_invalid_utf8(true),
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::DirPath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FIFO)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -162,7 +162,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.value_name("NAME")
|
||||
.help("name of the new file")
|
||||
.required(true)
|
||||
.index(1),
|
||||
.index(1)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("type")
|
||||
|
|
|
@ -202,7 +202,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
be an absolute name; unlike with -t, TEMPLATE may contain \
|
||||
slashes, but mktemp creates only the final component",
|
||||
)
|
||||
.value_name("DIR"),
|
||||
.value_name("DIR")
|
||||
.value_hint(clap::ValueHint::DirPath),
|
||||
)
|
||||
.arg(Arg::new(OPT_T).short('t').help(
|
||||
"Generate a template (using the supplied prefix and TMPDIR (TMP on windows) if set) \
|
||||
|
|
|
@ -183,7 +183,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::FILES)
|
||||
.required(false)
|
||||
.multiple_occurrences(true)
|
||||
.help("Path to the files to be read"),
|
||||
.help("Path to the files to be read")
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -156,14 +156,15 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.help("move all SOURCE arguments into DIRECTORY")
|
||||
.takes_value(true)
|
||||
.value_name("DIRECTORY")
|
||||
.value_hint(clap::ValueHint::DirPath)
|
||||
.conflicts_with(OPT_NO_TARGET_DIRECTORY)
|
||||
.allow_invalid_utf8(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::new(OPT_NO_TARGET_DIRECTORY)
|
||||
.short('T')
|
||||
.long(OPT_NO_TARGET_DIRECTORY).
|
||||
help("treat DEST as a normal file")
|
||||
.long(OPT_NO_TARGET_DIRECTORY)
|
||||
.help("treat DEST as a normal file")
|
||||
)
|
||||
.arg(
|
||||
Arg::new(OPT_UPDATE)
|
||||
|
@ -183,6 +184,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.min_values(2)
|
||||
.required(true)
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -117,5 +117,9 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.takes_value(true)
|
||||
.allow_hyphen_values(true),
|
||||
)
|
||||
.arg(Arg::new(options::COMMAND).multiple_occurrences(true))
|
||||
.arg(
|
||||
Arg::new(options::COMMAND)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::CommandName),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -154,7 +154,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::BODY_NUMBERING)
|
||||
|
|
|
@ -126,7 +126,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::CMD)
|
||||
.hide(true)
|
||||
.required(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::CommandName),
|
||||
)
|
||||
.trailing_var_arg(true)
|
||||
.infer_long_args(true)
|
||||
|
|
|
@ -512,7 +512,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILENAME)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::FILE)
|
||||
.value_name("FILE")
|
||||
.multiple_occurrences(true)
|
||||
.default_value("-"),
|
||||
.default_value("-")
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::PATH)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::USER)
|
||||
.takes_value(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::Username),
|
||||
)
|
||||
.arg(
|
||||
// Redefine the help argument to not include the short flag
|
||||
|
|
|
@ -372,6 +372,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::FILES)
|
||||
.multiple_occurrences(true)
|
||||
.multiple_values(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -754,7 +754,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::AUTO_REFERENCE)
|
||||
|
@ -826,7 +827,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::BREAK_FILE)
|
||||
.help("word break characters in this FILE")
|
||||
.value_name("FILE")
|
||||
.takes_value(true),
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::IGNORE_CASE)
|
||||
|
@ -849,7 +851,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::IGNORE_FILE)
|
||||
.help("read ignore word list from FILE")
|
||||
.value_name("FILE")
|
||||
.takes_value(true),
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::ONLY_FILE)
|
||||
|
@ -857,7 +860,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::ONLY_FILE)
|
||||
.help("read only word list from this FILE")
|
||||
.value_name("FILE")
|
||||
.takes_value(true),
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::REFERENCES)
|
||||
|
|
|
@ -161,7 +161,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(ARG_FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true),
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.required(true)
|
||||
.min_values(1),
|
||||
.min_values(1)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,15 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(Arg::new(options::DIR).short('d').takes_value(true).help(
|
||||
"If any of FROM and TO is not subpath of DIR, output absolute path instead of relative",
|
||||
))
|
||||
.arg(Arg::new(options::TO).required(true).takes_value(true))
|
||||
.arg(Arg::new(options::FROM).takes_value(true))
|
||||
.arg(
|
||||
Arg::new(options::TO)
|
||||
.required(true)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::FROM)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -227,6 +227,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.min_values(1)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.takes_value(true)
|
||||
.min_values(1)
|
||||
.required(true)
|
||||
.allow_invalid_utf8(true),
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::DirPath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -156,7 +156,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new("ARG")
|
||||
.multiple_occurrences(true)
|
||||
.allow_invalid_utf8(true),
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::CommandName),
|
||||
)
|
||||
// Once "ARG" is parsed, everything after that belongs to it.
|
||||
//
|
||||
|
|
|
@ -374,7 +374,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -158,14 +158,16 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::OUTPUT)
|
||||
.takes_value(true)
|
||||
.value_name("FILE")
|
||||
.help("write result to FILE instead of standard output"),
|
||||
.help("write result to FILE instead of standard output")
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::RANDOM_SOURCE)
|
||||
.long(options::RANDOM_SOURCE)
|
||||
.takes_value(true)
|
||||
.value_name("FILE")
|
||||
.help("get random bytes from FILE"),
|
||||
.help("get random bytes from FILE")
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::REPEAT)
|
||||
|
@ -179,7 +181,11 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::ZERO_TERMINATED)
|
||||
.help("line delimiter is NUL, not newline"),
|
||||
)
|
||||
.arg(Arg::new(options::FILE).takes_value(true))
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
fn read_input_file(filename: &str) -> UResult<Vec<u8>> {
|
||||
|
|
|
@ -1397,7 +1397,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::OUTPUT)
|
||||
.help("write output to FILENAME instead of stdout")
|
||||
.takes_value(true)
|
||||
.value_name("FILENAME"),
|
||||
.value_name("FILENAME")
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::REVERSE)
|
||||
|
@ -1461,13 +1462,15 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::TMP_DIR)
|
||||
.help("use DIR for temporaries, not $TMPDIR or /tmp")
|
||||
.takes_value(true)
|
||||
.value_name("DIR"),
|
||||
.value_name("DIR")
|
||||
.value_hint(clap::ValueHint::DirPath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::COMPRESS_PROG)
|
||||
.long(options::COMPRESS_PROG)
|
||||
.help("compress temporary files with PROG, decompress with PROG -d; PROG has to take input from stdin and output to stdout")
|
||||
.value_name("PROG"),
|
||||
.value_name("PROG")
|
||||
.value_hint(clap::ValueHint::CommandName),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::BATCH_SIZE)
|
||||
|
@ -1482,7 +1485,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.takes_value(true)
|
||||
.value_name("NUL_FILES")
|
||||
.multiple_occurrences(true)
|
||||
.allow_invalid_utf8(true),
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::DEBUG)
|
||||
|
@ -1493,7 +1497,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.allow_invalid_utf8(true),
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -111,9 +111,11 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(OPT_FILTER)
|
||||
.long(OPT_FILTER)
|
||||
.takes_value(true)
|
||||
.value_name("COMMAND")
|
||||
.value_hint(clap::ValueHint::CommandName)
|
||||
.help(
|
||||
"write to shell COMMAND file name is $FILE (Currently not implemented for Windows)",
|
||||
),
|
||||
"write to shell COMMAND; file name is $FILE (Currently not implemented for Windows)",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(OPT_ELIDE_EMPTY_FILES)
|
||||
|
@ -162,7 +164,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(ARG_INPUT)
|
||||
.takes_value(true)
|
||||
.default_value("-")
|
||||
.index(1),
|
||||
.index(1)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(ARG_PREFIX)
|
||||
|
|
|
@ -1043,6 +1043,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.allow_invalid_utf8(true)
|
||||
.min_values(1),
|
||||
.min_values(1)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -232,6 +232,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.hide(true)
|
||||
.required(true),
|
||||
.required(true)
|
||||
.value_hint(clap::ValueHint::CommandName),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -150,7 +150,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.multiple_occurrences(true)
|
||||
.hide(true),
|
||||
.hide(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::BSD_COMPATIBLE)
|
||||
|
|
|
@ -217,7 +217,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(ARG_FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true),
|
||||
.takes_value(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true),
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -351,7 +351,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::ARG_FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.min_values(1),
|
||||
.min_values(1)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,11 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.short('i')
|
||||
.help("ignore interrupt signals (ignored on non-Unix platforms)"),
|
||||
)
|
||||
.arg(Arg::new(options::FILE).multiple_occurrences(true))
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
|
|
|
@ -170,6 +170,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.index(2)
|
||||
.required(true)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::CommandName)
|
||||
)
|
||||
.trailing_var_arg(true)
|
||||
.infer_long_args(true)
|
||||
|
|
|
@ -219,7 +219,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.long(options::sources::REFERENCE)
|
||||
.help("use this file's times instead of the current time")
|
||||
.value_name("FILE")
|
||||
.allow_invalid_utf8(true),
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::TIME)
|
||||
|
@ -238,7 +239,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.min_values(1)
|
||||
.allow_invalid_utf8(true),
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
.group(ArgGroup::new(options::SOURCES).args(&[
|
||||
options::sources::CURRENT,
|
||||
|
|
|
@ -143,7 +143,6 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.infer_long_args(true)
|
||||
.infer_long_args(true)
|
||||
.arg(
|
||||
Arg::new(options::COMPLEMENT)
|
||||
.visible_short_alias('C')
|
||||
|
|
|
@ -162,6 +162,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.required_unless_present(options::SIZE)
|
||||
.help("base the size of each file on the size of RFILE")
|
||||
.value_name("RFILE")
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::SIZE)
|
||||
|
@ -176,7 +177,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.required(true)
|
||||
.min_values(1))
|
||||
.min_values(1)
|
||||
.value_hint(clap::ValueHint::FilePath))
|
||||
}
|
||||
|
||||
/// Truncate the named file to the specified size.
|
||||
|
|
|
@ -99,7 +99,12 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.override_usage(format_usage(USAGE))
|
||||
.about(SUMMARY)
|
||||
.infer_long_args(true)
|
||||
.arg(Arg::new(options::FILE).default_value("-").hide(true))
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.default_value("-")
|
||||
.hide(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
// We use String as a representation of node here
|
||||
|
|
|
@ -109,7 +109,12 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.override_usage(format_usage(USAGE))
|
||||
.about(SUMMARY)
|
||||
.infer_long_args(true)
|
||||
.arg(Arg::new(options::FILE).hide(true).multiple_occurrences(true))
|
||||
.arg(
|
||||
Arg::new(options::FILE)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::ALL)
|
||||
.short('a')
|
||||
|
|
|
@ -392,7 +392,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(ARG_FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.max_values(2),
|
||||
.max_values(2)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(OPT_PATH)
|
||||
.required(true)
|
||||
.hide(true)
|
||||
.allow_invalid_utf8(true),
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::AnyPath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -64,5 +64,10 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.infer_long_args(true)
|
||||
.arg(Arg::new(ARG_FILES).takes_value(true).max_values(1))
|
||||
.arg(
|
||||
Arg::new(ARG_FILES)
|
||||
.takes_value(true)
|
||||
.max_values(1)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -210,7 +210,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
"read input from the files specified by
|
||||
NUL-terminated names in file F;
|
||||
If F is - then read names from standard input",
|
||||
),
|
||||
)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::LINES)
|
||||
|
@ -234,7 +235,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(ARG_FILES)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.allow_invalid_utf8(true),
|
||||
.allow_invalid_utf8(true)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,8 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(options::FILE)
|
||||
.takes_value(true)
|
||||
.min_values(1)
|
||||
.max_values(2),
|
||||
.max_values(2)
|
||||
.value_hint(clap::ValueHint::FilePath),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -456,6 +456,7 @@ pub fn chown_base<'a>(
|
|||
command = command.arg(
|
||||
Arg::new(options::ARG_FILES)
|
||||
.value_name(options::ARG_FILES)
|
||||
.value_hint(clap::ValueHint::FilePath)
|
||||
.multiple_occurrences(true)
|
||||
.takes_value(true)
|
||||
.required(true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue