mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
Merge pull request #3771 from cakebaker/clap_replace_deprecated_possible_values
Replace possible_values() with value_parser()
This commit is contained in:
commit
9b28debd50
13 changed files with 27 additions and 25 deletions
|
@ -142,12 +142,14 @@ fn gen_completions<T: uucore::Args>(
|
||||||
.about("Prints completions to stdout")
|
.about("Prints completions to stdout")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("utility")
|
Arg::new("utility")
|
||||||
.possible_values(all_utilities)
|
.value_parser(clap::builder::PossibleValuesParser::new(all_utilities))
|
||||||
.required(true),
|
.required(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("shell")
|
Arg::new("shell")
|
||||||
.possible_values(Shell::possible_values())
|
.value_parser(clap::builder::PossibleValuesParser::new(
|
||||||
|
Shell::possible_values(),
|
||||||
|
))
|
||||||
.required(true),
|
.required(true),
|
||||||
)
|
)
|
||||||
.get_matches_from(std::iter::once(OsString::from("completion")).chain(args));
|
.get_matches_from(std::iter::once(OsString::from("completion")).chain(args));
|
||||||
|
|
|
@ -401,7 +401,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.multiple_occurrences(true)
|
.multiple_occurrences(true)
|
||||||
.use_value_delimiter(true)
|
.use_value_delimiter(true)
|
||||||
.possible_values(PRESERVABLE_ATTRIBUTES)
|
.value_parser(clap::builder::PossibleValuesParser::new(PRESERVABLE_ATTRIBUTES))
|
||||||
.min_values(0)
|
.min_values(0)
|
||||||
.value_name("ATTR_LIST")
|
.value_name("ATTR_LIST")
|
||||||
.overrides_with_all(&[options::ARCHIVE, options::PRESERVE_DEFAULT_ATTRIBUTES, options::NO_PRESERVE])
|
.overrides_with_all(&[options::ARCHIVE, options::PRESERVE_DEFAULT_ATTRIBUTES, options::NO_PRESERVE])
|
||||||
|
@ -451,7 +451,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.long(options::SPARSE)
|
.long(options::SPARSE)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.value_name("WHEN")
|
.value_name("WHEN")
|
||||||
.possible_values(["never", "auto", "always"])
|
.value_parser(["never", "auto", "always"])
|
||||||
.help("NotImplemented: control creation of sparse files. See below"))
|
.help("NotImplemented: control creation of sparse files. See below"))
|
||||||
|
|
||||||
// TODO: implement the following args
|
// TODO: implement the following args
|
||||||
|
|
|
@ -559,7 +559,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
.use_value_delimiter(true)
|
.use_value_delimiter(true)
|
||||||
.multiple_occurrences(true)
|
.multiple_occurrences(true)
|
||||||
.possible_values(OUTPUT_FIELD_LIST)
|
.value_parser(OUTPUT_FIELD_LIST)
|
||||||
.default_missing_values(&OUTPUT_FIELD_LIST)
|
.default_missing_values(&OUTPUT_FIELD_LIST)
|
||||||
.default_values(&["source", "size", "used", "avail", "pcent", "target"])
|
.default_values(&["source", "size", "used", "avail", "pcent", "target"])
|
||||||
.conflicts_with_all(&[OPT_INODES, OPT_PORTABILITY, OPT_PRINT_TYPE])
|
.conflicts_with_all(&[OPT_INODES, OPT_PORTABILITY, OPT_PRINT_TYPE])
|
||||||
|
|
|
@ -895,7 +895,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.value_name("WORD")
|
.value_name("WORD")
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
.min_values(0)
|
.min_values(0)
|
||||||
.possible_values(&["atime", "access", "use", "ctime", "status", "birth", "creation"])
|
.value_parser(["atime", "access", "use", "ctime", "status", "birth", "creation"])
|
||||||
.help(
|
.help(
|
||||||
"show time of the last modification of any file in the \
|
"show time of the last modification of any file in the \
|
||||||
directory, or any of its subdirectories. If WORD is given, show time as WORD instead \
|
directory, or any of its subdirectories. If WORD is given, show time as WORD instead \
|
||||||
|
|
|
@ -713,7 +713,7 @@ When FILE1 or FILE2 (not both) is -, read standard input.",
|
||||||
.short('a')
|
.short('a')
|
||||||
.multiple_occurrences(true)
|
.multiple_occurrences(true)
|
||||||
.number_of_values(1)
|
.number_of_values(1)
|
||||||
.possible_values(&["1", "2"])
|
.value_parser(["1", "2"])
|
||||||
.value_name("FILENUM")
|
.value_name("FILENUM")
|
||||||
.help(
|
.help(
|
||||||
"also print unpairable lines from file FILENUM, where
|
"also print unpairable lines from file FILENUM, where
|
||||||
|
@ -725,7 +725,7 @@ FILENUM is 1 or 2, corresponding to FILE1 or FILE2",
|
||||||
.short('v')
|
.short('v')
|
||||||
.multiple_occurrences(true)
|
.multiple_occurrences(true)
|
||||||
.number_of_values(1)
|
.number_of_values(1)
|
||||||
.possible_values(&["1", "2"])
|
.value_parser(["1", "2"])
|
||||||
.value_name("FILENUM")
|
.value_name("FILENUM")
|
||||||
.help("like -a FILENUM, but suppress joined output lines"),
|
.help("like -a FILENUM, but suppress joined output lines"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -911,7 +911,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.long(options::FORMAT)
|
.long(options::FORMAT)
|
||||||
.help("Set the display format.")
|
.help("Set the display format.")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.possible_values(&[
|
.value_parser([
|
||||||
"long",
|
"long",
|
||||||
"verbose",
|
"verbose",
|
||||||
"single-column",
|
"single-column",
|
||||||
|
@ -1042,7 +1042,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.long(options::QUOTING_STYLE)
|
.long(options::QUOTING_STYLE)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Set quoting style.")
|
.help("Set quoting style.")
|
||||||
.possible_values(&[
|
.value_parser([
|
||||||
"literal",
|
"literal",
|
||||||
"shell",
|
"shell",
|
||||||
"shell-always",
|
"shell-always",
|
||||||
|
@ -1120,7 +1120,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
)
|
)
|
||||||
.value_name("field")
|
.value_name("field")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.possible_values(&[
|
.value_parser([
|
||||||
"atime", "access", "use", "ctime", "status", "birth", "creation",
|
"atime", "access", "use", "ctime", "status", "birth", "creation",
|
||||||
])
|
])
|
||||||
.hide_possible_values(true)
|
.hide_possible_values(true)
|
||||||
|
@ -1182,7 +1182,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.help("Sort by <field>: name, none (-U), time (-t), size (-S) or extension (-X)")
|
.help("Sort by <field>: name, none (-U), time (-t), size (-S) or extension (-X)")
|
||||||
.value_name("field")
|
.value_name("field")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.possible_values(&["name", "none", "time", "size", "version", "extension"])
|
.value_parser(["name", "none", "time", "size", "version", "extension"])
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
.overrides_with_all(&[
|
.overrides_with_all(&[
|
||||||
options::SORT,
|
options::SORT,
|
||||||
|
@ -1411,7 +1411,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.long(options::COLOR)
|
.long(options::COLOR)
|
||||||
.help("Color output based on file type.")
|
.help("Color output based on file type.")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.possible_values(&[
|
.value_parser([
|
||||||
"always", "yes", "force", "auto", "tty", "if-tty", "never", "no", "none",
|
"always", "yes", "force", "auto", "tty", "if-tty", "never", "no", "none",
|
||||||
])
|
])
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
|
@ -1425,7 +1425,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
none (default), slash (-p), file-type (--file-type), classify (-F)",
|
none (default), slash (-p), file-type (--file-type), classify (-F)",
|
||||||
)
|
)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.possible_values(&["none", "slash", "file-type", "classify"])
|
.value_parser(["none", "slash", "file-type", "classify"])
|
||||||
.overrides_with_all(&[
|
.overrides_with_all(&[
|
||||||
options::indicator_style::FILE_TYPE,
|
options::indicator_style::FILE_TYPE,
|
||||||
options::indicator_style::SLASH,
|
options::indicator_style::SLASH,
|
||||||
|
@ -1456,7 +1456,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
)
|
)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.value_name("when")
|
.value_name("when")
|
||||||
.possible_values(&[
|
.value_parser([
|
||||||
"always", "yes", "force", "auto", "tty", "if-tty", "never", "no", "none",
|
"always", "yes", "force", "auto", "tty", "if-tty", "never", "no", "none",
|
||||||
])
|
])
|
||||||
.default_missing_value("always")
|
.default_missing_value("always")
|
||||||
|
@ -1498,7 +1498,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.help("time/date format with -l; see TIME_STYLE below")
|
.help("time/date format with -l; see TIME_STYLE below")
|
||||||
.value_name("TIME_STYLE")
|
.value_name("TIME_STYLE")
|
||||||
.env("TIME_STYLE")
|
.env("TIME_STYLE")
|
||||||
.possible_values(&["full-iso", "long-iso", "iso", "locale"])
|
.value_parser(["full-iso", "long-iso", "iso", "locale"])
|
||||||
.overrides_with_all(&[options::TIME_STYLE]),
|
.overrides_with_all(&[options::TIME_STYLE]),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
|
@ -375,7 +375,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
)
|
)
|
||||||
.value_name("METHOD")
|
.value_name("METHOD")
|
||||||
.default_value("from-zero")
|
.default_value("from-zero")
|
||||||
.possible_values(&["up", "down", "from-zero", "towards-zero", "nearest"]),
|
.value_parser(["up", "down", "from-zero", "towards-zero", "nearest"]),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::SUFFIX)
|
Arg::new(options::SUFFIX)
|
||||||
|
|
|
@ -332,7 +332,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
Arg::new(options::ENDIAN)
|
Arg::new(options::ENDIAN)
|
||||||
.long(options::ENDIAN)
|
.long(options::ENDIAN)
|
||||||
.help("byte order to use for multi-byte formats")
|
.help("byte order to use for multi-byte formats")
|
||||||
.possible_values(&["big", "little"])
|
.value_parser(["big", "little"])
|
||||||
.value_name("big|little"),
|
.value_name("big|little"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
|
@ -1286,7 +1286,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
Arg::new(options::modes::SORT)
|
Arg::new(options::modes::SORT)
|
||||||
.long(options::modes::SORT)
|
.long(options::modes::SORT)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.possible_values(&[
|
.value_parser([
|
||||||
"general-numeric",
|
"general-numeric",
|
||||||
"human-numeric",
|
"human-numeric",
|
||||||
"month",
|
"month",
|
||||||
|
@ -1351,7 +1351,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
.min_values(0)
|
.min_values(0)
|
||||||
.possible_values(&[
|
.value_parser([
|
||||||
options::check::SILENT,
|
options::check::SILENT,
|
||||||
options::check::QUIET,
|
options::check::QUIET,
|
||||||
options::check::DIAGNOSE_FIRST,
|
options::check::DIAGNOSE_FIRST,
|
||||||
|
|
|
@ -585,7 +585,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.min_values(0)
|
.min_values(0)
|
||||||
.max_values(1)
|
.max_values(1)
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
.possible_values(&["descriptor", "name"])
|
.value_parser(["descriptor", "name"])
|
||||||
.help("Print the file as it grows"),
|
.help("Print the file as it grows"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
|
@ -122,7 +122,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
.min_values(0)
|
.min_values(0)
|
||||||
.max_values(1)
|
.max_values(1)
|
||||||
.possible_values([
|
.value_parser([
|
||||||
PossibleValue::new("warn")
|
PossibleValue::new("warn")
|
||||||
.help("produce warnings for errors writing to any output"),
|
.help("produce warnings for errors writing to any output"),
|
||||||
PossibleValue::new("warn-nopipe")
|
PossibleValue::new("warn-nopipe")
|
||||||
|
|
|
@ -234,7 +234,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
equivalent to -m",
|
equivalent to -m",
|
||||||
)
|
)
|
||||||
.value_name("WORD")
|
.value_name("WORD")
|
||||||
.possible_values(&["access", "atime", "use"])
|
.value_parser(["access", "atime", "use"])
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|
|
@ -311,7 +311,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
Arg::new(options::ALL_REPEATED)
|
Arg::new(options::ALL_REPEATED)
|
||||||
.short('D')
|
.short('D')
|
||||||
.long(options::ALL_REPEATED)
|
.long(options::ALL_REPEATED)
|
||||||
.possible_values(&[
|
.value_parser([
|
||||||
"none",
|
"none",
|
||||||
"prepend",
|
"prepend",
|
||||||
"separate"
|
"separate"
|
||||||
|
@ -326,7 +326,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new(options::GROUP)
|
Arg::new(options::GROUP)
|
||||||
.long(options::GROUP)
|
.long(options::GROUP)
|
||||||
.possible_values(&[
|
.value_parser([
|
||||||
"separate",
|
"separate",
|
||||||
"prepend",
|
"prepend",
|
||||||
"append",
|
"append",
|
||||||
|
|
Loading…
Reference in a new issue