From 0664c6db37f0fecda12e5f192a0579a6fd369db4 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 3 Aug 2022 10:59:42 -0500 Subject: [PATCH] fix!: Remove Arg::use_value_delimiter in favor of Arg::value_delimiter --- CHANGELOG.md | 1 + examples/multicall-busybox.rs | 3 +- src/builder/arg.rs | 109 ++++-------------------------- src/builder/arg_settings.rs | 3 - src/builder/command.rs | 4 +- src/builder/debug_asserts.rs | 1 - src/error/kind.rs | 1 - src/parser/matches/arg_matches.rs | 4 +- tests/builder/app_settings.rs | 12 ++-- tests/builder/default_vals.rs | 4 +- tests/builder/delimiters.rs | 2 +- tests/builder/env.rs | 4 +- tests/builder/grouped_values.rs | 4 +- tests/builder/help.rs | 6 +- tests/builder/indices.rs | 2 +- tests/builder/multiple_values.rs | 30 ++++---- tests/builder/opts.rs | 6 +- 17 files changed, 51 insertions(+), 145 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9ade3d6..8789bafb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Remove `Arg::min_values` (across all occurrences) with `Arg::number_of_values(N..)` (per occurrence) - Remove `Arg::max_values` (across all occurrences) with `Arg::number_of_values(1..=M)` (per occurrence) - Remove `Arg::multiple_values(true)` with `Arg::number_of_values(1..)` and `Arg::multiple_values(false)` with `Arg::number_of_values(0)` +- Remove `Arg::use_value_delimiter` in favor of `Arg::value_delimiter` - `ArgAction::SetTrue` and `ArgAction::SetFalse` now prioritize `Arg::default_missing_value` over their standard behavior - *(help)* Make `DeriveDisplayOrder` the default and removed the setting. To sort help, set `next_display_order(None)` (#2808) - *(help)* Subcommand display order respects `Command::next_display_order` instead of `DeriveDisplayOrder` and using its own initial display order value (#2808) diff --git a/examples/multicall-busybox.rs b/examples/multicall-busybox.rs index 1f0a981b..85cd3a14 100644 --- a/examples/multicall-busybox.rs +++ b/examples/multicall-busybox.rs @@ -25,8 +25,7 @@ fn main() { .exclusive(true) .action(ArgAction::Set) .default_missing_value("/usr/local/bin") - .value_parser(value_parser!(PathBuf)) - .use_value_delimiter(false), + .value_parser(value_parser!(PathBuf)), ) .subcommands(applet_commands()), ) diff --git a/src/builder/arg.rs b/src/builder/arg.rs index da037358..5ac7019d 100644 --- a/src/builder/arg.rs +++ b/src/builder/arg.rs @@ -786,12 +786,6 @@ impl<'help> Arg<'help> { /// - Using an equals and no space such as `-o=value` or `--option=value` /// - Use a short and no space such as `-ovalue` /// - /// **NOTE:** By default, args which allow [multiple values] are delimited by commas, meaning - /// `--option=val1,val2,val3` is three values for the `--option` argument. If you wish to - /// change the delimiter to another character you can use [`Arg::value_delimiter(char)`], - /// alternatively you can turn delimiting values **OFF** by using - /// [`Arg::use_value_delimiter(false)`][Arg::use_value_delimiter] - /// /// # Examples /// /// ```rust @@ -807,7 +801,6 @@ impl<'help> Arg<'help> { /// assert!(m.contains_id("mode")); /// assert_eq!(m.get_one::("mode").unwrap(), "fast"); /// ``` - /// [`Arg::value_delimiter(char)`]: Arg::value_delimiter() /// [multiple values]: Arg::number_of_values #[inline] #[must_use] @@ -1060,7 +1053,6 @@ impl<'help> Arg<'help> { /// assert_eq!(files, ["file1", "file2", "file3"]); /// assert_eq!(m.get_one::("word").unwrap(), "word"); /// ``` - /// [`Arg::value_delimiter(char)`]: Arg::value_delimiter() #[inline] #[must_use] pub fn number_of_values(mut self, qty: impl Into) -> Self { @@ -1385,72 +1377,12 @@ impl<'help> Arg<'help> { } } - /// Specifies that an argument should allow grouping of multiple values via a - /// delimiter. + /// Allow grouping of multiple values via a delimiter. /// /// i.e. should `--option=val1,val2,val3` be parsed as three values (`val1`, `val2`, /// and `val3`) or as a single value (`val1,val2,val3`). Defaults to using `,` (comma) as the /// value delimiter for all arguments that accept values (options and positional arguments) /// - /// **NOTE:** When this setting is used, it will default [`Arg::value_delimiter`] - /// to the comma `,`. - /// - /// **NOTE:** Implicitly sets [`Arg::takes_value`] - /// - /// # Examples - /// - /// The following example shows the default behavior. - /// - /// ```rust - /// # use clap::{Command, Arg, ArgAction}; - /// let delims = Command::new("prog") - /// .arg(Arg::new("option") - /// .long("option") - /// .use_value_delimiter(true) - /// .action(ArgAction::Set)) - /// .get_matches_from(vec![ - /// "prog", "--option=val1,val2,val3", - /// ]); - /// - /// assert!(delims.contains_id("option")); - /// assert_eq!(delims.get_many::("option").unwrap().collect::>(), ["val1", "val2", "val3"]); - /// ``` - /// The next example shows the difference when turning delimiters off. This is the default - /// behavior - /// - /// ```rust - /// # use clap::{Command, Arg, ArgAction}; - /// let nodelims = Command::new("prog") - /// .arg(Arg::new("option") - /// .long("option") - /// .action(ArgAction::Set)) - /// .get_matches_from(vec![ - /// "prog", "--option=val1,val2,val3", - /// ]); - /// - /// assert!(nodelims.contains_id("option")); - /// assert_eq!(nodelims.get_one::("option").unwrap(), "val1,val2,val3"); - /// ``` - /// [`Arg::value_delimiter`]: Arg::value_delimiter() - #[inline] - #[must_use] - pub fn use_value_delimiter(mut self, yes: bool) -> Self { - if yes { - if self.val_delim.is_none() { - self.val_delim = Some(','); - } - self.takes_value(true) - .setting(ArgSettings::UseValueDelimiter) - } else { - self.val_delim = None; - self.unset_setting(ArgSettings::UseValueDelimiter) - } - } - - /// Separator between the arguments values, defaults to `,` (comma). - /// - /// **NOTE:** implicitly sets [`Arg::use_value_delimiter(true)`] - /// /// **NOTE:** implicitly sets [`Arg::action(ArgAction::Set)`] /// /// # Examples @@ -1461,20 +1393,20 @@ impl<'help> Arg<'help> { /// .arg(Arg::new("config") /// .short('c') /// .long("config") - /// .value_delimiter(';')) + /// .value_delimiter(',')) /// .get_matches_from(vec![ - /// "prog", "--config=val1;val2;val3" + /// "prog", "--config=val1,val2,val3" /// ]); /// /// assert_eq!(m.get_many::("config").unwrap().collect::>(), ["val1", "val2", "val3"]) /// ``` - /// [`Arg::use_value_delimiter(true)`]: Arg::use_value_delimiter() + /// [`Arg::value_delimiter(',')`]: Arg::use_value_delimiter() /// [`Arg::action(ArgAction::Set)`]: Arg::takes_value() #[inline] #[must_use] - pub fn value_delimiter(mut self, d: char) -> Self { - self.val_delim = Some(d); - self.takes_value(true).use_value_delimiter(true) + pub fn value_delimiter(mut self, d: impl Into>) -> Self { + self.val_delim = d.into(); + self.takes_value(true) } /// Specifies that *multiple values* may only be set using the delimiter. @@ -1483,11 +1415,6 @@ impl<'help> Arg<'help> { /// additional values for that option follow. This is unlike the default, where it is generally /// assumed that more values will follow regardless of whether or not a delimiter is used. /// - /// **NOTE:** The default is `false`. - /// - /// **NOTE:** Setting this requires [`Arg::use_value_delimiter`] and - /// [`Arg::takes_value`] - /// /// **NOTE:** It's a good idea to inform the user that use of a delimiter is required, either /// through help text or other means. /// @@ -1502,7 +1429,7 @@ impl<'help> Arg<'help> { /// .arg(Arg::new("opt") /// .short('o') /// .action(ArgAction::Set) - /// .use_value_delimiter(true) + /// .value_delimiter(',') /// .require_value_delimiter(true) /// .number_of_values(1..)) /// .get_matches_from(vec![ @@ -1521,7 +1448,6 @@ impl<'help> Arg<'help> { /// .arg(Arg::new("opt") /// .short('o') /// .action(ArgAction::Set) - /// .use_value_delimiter(true) /// .require_value_delimiter(true)) /// .try_get_matches_from(vec![ /// "prog", "-o", "val1", "val2", "val3", @@ -1555,9 +1481,11 @@ impl<'help> Arg<'help> { /// ``` #[inline] #[must_use] - pub fn require_value_delimiter(self, yes: bool) -> Self { + pub fn require_value_delimiter(mut self, yes: bool) -> Self { if yes { + self.val_delim.get_or_insert(','); self.setting(ArgSettings::RequireDelimiter) + .takes_value(true) } else { self.unset_setting(ArgSettings::RequireDelimiter) } @@ -2009,7 +1937,7 @@ impl<'help> Arg<'help> { /// .env("MY_FLAG_MULTI") /// .action(ArgAction::Set) /// .number_of_values(1..) - /// .use_value_delimiter(true)) + /// .value_delimiter(',')) /// .get_matches_from(vec![ /// "prog" /// ]); @@ -2017,7 +1945,7 @@ impl<'help> Arg<'help> { /// assert_eq!(m.get_many::("flag").unwrap().collect::>(), vec!["env1", "env2"]); /// ``` /// [`Arg::action(ArgAction::Set)`]: Arg::takes_value() - /// [`Arg::use_value_delimiter(true)`]: Arg::use_value_delimiter() + /// [`Arg::value_delimiter(',')`]: Arg::use_value_delimiter() #[cfg(feature = "env")] #[inline] #[must_use] @@ -4061,11 +3989,6 @@ impl<'help> Arg<'help> { self.is_set(ArgSettings::HiddenLongHelp) } - /// Report whether [`Arg::use_value_delimiter`] is set - pub fn is_use_value_delimiter_set(&self) -> bool { - self.is_set(ArgSettings::UseValueDelimiter) - } - /// Report whether [`Arg::require_value_delimiter`] is set pub fn is_require_value_delimiter_set(&self) -> bool { self.is_set(ArgSettings::RequireDelimiter) @@ -4144,12 +4067,6 @@ impl<'help> Arg<'help> { } } - if (self.is_use_value_delimiter_set() || self.is_require_value_delimiter_set()) - && self.val_delim.is_none() - { - self.val_delim = Some(','); - } - let val_names_len = self.val_names.len(); if val_names_len > 1 { self.settings.set(ArgSettings::MultipleValues); diff --git a/src/builder/arg_settings.rs b/src/builder/arg_settings.rs index bf30cb57..5eb6f96b 100644 --- a/src/builder/arg_settings.rs +++ b/src/builder/arg_settings.rs @@ -32,7 +32,6 @@ pub(crate) enum ArgSettings { Global, Hidden, TakesValue, - UseValueDelimiter, NextLineHelp, RequireDelimiter, HidePossibleValues, @@ -56,7 +55,6 @@ bitflags! { const GLOBAL = 1 << 3; const HIDDEN = 1 << 4; const TAKES_VAL = 1 << 5; - const USE_DELIM = 1 << 6; const NEXT_LINE_HELP = 1 << 7; const REQ_DELIM = 1 << 9; const DELIM_NOT_SET = 1 << 10; @@ -84,7 +82,6 @@ impl_settings! { ArgSettings, ArgFlags, Global => Flags::GLOBAL, Hidden => Flags::HIDDEN, TakesValue => Flags::TAKES_VAL, - UseValueDelimiter => Flags::USE_DELIM, NextLineHelp => Flags::NEXT_LINE_HELP, RequireDelimiter => Flags::REQ_DELIM, HidePossibleValues => Flags::HIDE_POS_VALS, diff --git a/src/builder/command.rs b/src/builder/command.rs index 2187d727..58c31a54 100644 --- a/src/builder/command.rs +++ b/src/builder/command.rs @@ -972,7 +972,7 @@ impl<'help> Command<'help> { /// was used. /// /// **NOTE:** The same thing can be done manually by setting the final positional argument to - /// [`Arg::use_value_delimiter(false)`]. Using this setting is safer, because it's easier to locate + /// [`Arg::value_delimiter(None)`]. Using this setting is safer, because it's easier to locate /// when making changes. /// /// **NOTE:** This choice is propagated to all child subcommands. @@ -986,7 +986,7 @@ impl<'help> Command<'help> { /// .get_matches(); /// ``` /// - /// [`Arg::use_value_delimiter(false)`]: crate::Arg::use_value_delimiter() + /// [`Arg::value_delimiter(None)`]: crate::Arg::value_delimiter() #[inline] pub fn dont_delimit_trailing_values(self, yes: bool) -> Self { if yes { diff --git a/src/builder/debug_asserts.rs b/src/builder/debug_asserts.rs index ae4bbf74..38b744fb 100644 --- a/src/builder/debug_asserts.rs +++ b/src/builder/debug_asserts.rs @@ -759,7 +759,6 @@ fn assert_arg_flags(arg: &Arg) { } checker!(is_require_value_delimiter_set requires is_takes_value_set); - checker!(is_require_value_delimiter_set requires is_use_value_delimiter_set); checker!(is_hide_possible_values_set requires is_takes_value_set); checker!(is_allow_hyphen_values_set requires is_takes_value_set); checker!(is_require_equals_set requires is_takes_value_set); diff --git a/src/error/kind.rs b/src/error/kind.rs index ac6efb2b..77f74cea 100644 --- a/src/error/kind.rs +++ b/src/error/kind.rs @@ -105,7 +105,6 @@ pub enum ErrorKind { /// let result = Command::new("prog") /// .arg(Arg::new("arg") /// .number_of_values(1..=2) - /// .use_value_delimiter(true) /// .require_value_delimiter(true)) /// .try_get_matches_from(vec!["prog", "too,many,values"]); /// assert!(result.is_err()); diff --git a/src/parser/matches/arg_matches.rs b/src/parser/matches/arg_matches.rs index c4ce0e98..e146fab1 100644 --- a/src/parser/matches/arg_matches.rs +++ b/src/parser/matches/arg_matches.rs @@ -543,7 +543,7 @@ impl ArgMatches { /// let m = Command::new("myapp") /// .arg(Arg::new("option") /// .short('o') - /// .use_value_delimiter(true) + /// .value_delimiter(',') /// .number_of_values(1..)) /// .get_matches_from(vec!["myapp", "-o=val1,val2,val3"]); /// // ARGV indices: ^0 ^1 @@ -585,7 +585,7 @@ impl ArgMatches { /// let m = Command::new("myapp") /// .arg(Arg::new("option") /// .short('o') - /// .use_value_delimiter(true)) + /// .value_delimiter(',')) /// .get_matches_from(vec!["myapp", "-o=val1,val2,val3"]); /// // ARGV indices: ^0 ^1 /// // clap indices: ^2 ^3 ^4 diff --git a/tests/builder/app_settings.rs b/tests/builder/app_settings.rs index 46e49d81..9720c29b 100644 --- a/tests/builder/app_settings.rs +++ b/tests/builder/app_settings.rs @@ -395,7 +395,7 @@ fn delim_values_only_pos_follows_with_delim() { let r = Command::new("onlypos") .args(&[ arg!(f: -f [flag] "some opt"), - arg!([arg] ... "some arg").use_value_delimiter(true), + arg!([arg] ... "some arg").value_delimiter(','), ]) .try_get_matches_from(vec!["", "--", "-f", "-g,x"]); assert!(r.is_ok(), "{}", r.unwrap_err()); @@ -415,7 +415,7 @@ fn delim_values_only_pos_follows_with_delim() { fn delim_values_trailingvararg_with_delim() { let m = Command::new("positional") .trailing_var_arg(true) - .arg(arg!([opt] ... "some pos").use_value_delimiter(true)) + .arg(arg!([opt] ... "some pos").value_delimiter(',')) .try_get_matches_from(vec!["", "test", "--foo", "-Wl,-bar"]) .unwrap(); assert!(m.contains_id("opt")); @@ -1150,7 +1150,7 @@ fn aaos_opts_mult_req_delims() { .arg( arg!(--opt ... "some option") .action(ArgAction::Set) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true) .action(ArgAction::Append), ) @@ -1219,11 +1219,7 @@ fn aaos_pos_mult() { #[test] fn aaos_option_use_delim_false() { let m = Command::new("posix") - .arg( - arg!(--opt "some option") - .use_value_delimiter(false) - .action(ArgAction::Set), - ) + .arg(arg!(--opt "some option").action(ArgAction::Set)) .try_get_matches_from(vec!["", "--opt=some,other", "--opt=one,two"]) .unwrap(); assert!(m.contains_id("opt")); diff --git a/tests/builder/default_vals.rs b/tests/builder/default_vals.rs index fc3ac690..e49325cd 100644 --- a/tests/builder/default_vals.rs +++ b/tests/builder/default_vals.rs @@ -822,7 +822,7 @@ fn valid_delimited_default_values() { .arg( Arg::new("arg") .value_parser(clap::value_parser!(u32)) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true) .default_value("1,2,3"), ) @@ -839,7 +839,7 @@ fn invalid_delimited_default_values() { .arg( Arg::new("arg") .value_parser(clap::value_parser!(u32)) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true) .default_value("one,two"), ) diff --git a/tests/builder/delimiters.rs b/tests/builder/delimiters.rs index 91c296e5..bc898604 100644 --- a/tests/builder/delimiters.rs +++ b/tests/builder/delimiters.rs @@ -109,7 +109,7 @@ fn opt_eq_mult_def_delim() { .long("opt") .action(ArgAction::Set) .number_of_values(1..) - .use_value_delimiter(true), + .value_delimiter(','), ) .try_get_matches_from(vec!["", "--opt=val1,val2,val3"]); diff --git a/tests/builder/env.rs b/tests/builder/env.rs index ffc09f1f..94d8d617 100644 --- a/tests/builder/env.rs +++ b/tests/builder/env.rs @@ -229,7 +229,7 @@ fn multiple_one() { arg!([arg] "some opt") .env("CLP_TEST_ENV_MO") .action(ArgAction::Set) - .use_value_delimiter(true) + .value_delimiter(',') .number_of_values(1..), ) .try_get_matches_from(vec![""]); @@ -255,7 +255,7 @@ fn multiple_three() { arg!([arg] "some opt") .env("CLP_TEST_ENV_MULTI1") .action(ArgAction::Set) - .use_value_delimiter(true) + .value_delimiter(',') .number_of_values(1..), ) .try_get_matches_from(vec![""]); diff --git a/tests/builder/grouped_values.rs b/tests/builder/grouped_values.rs index 56646630..d6e8a7c9 100644 --- a/tests/builder/grouped_values.rs +++ b/tests/builder/grouped_values.rs @@ -68,7 +68,7 @@ fn grouped_value_long_flag_delimiter() { Arg::new("option") .long("option") .action(ArgAction::Set) - .use_value_delimiter(true) + .value_delimiter(',') .number_of_values(1..) .action(ArgAction::Append), ) @@ -98,7 +98,7 @@ fn grouped_value_short_flag_delimiter() { Arg::new("option") .short('o') .action(ArgAction::Set) - .use_value_delimiter(true) + .value_delimiter(',') .number_of_values(1..) .action(ArgAction::Append), ) diff --git a/tests/builder/help.rs b/tests/builder/help.rs index 73a6e878..11fdc02f 100644 --- a/tests/builder/help.rs +++ b/tests/builder/help.rs @@ -1602,7 +1602,7 @@ OPTIONS: .required(true) .value_names(&["some", "val"]) .action(ArgAction::Set) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true) .value_delimiter(':'), ); @@ -1638,7 +1638,7 @@ NETWORKING: .required(true) .value_names(&["some", "val"]) .action(ArgAction::Set) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true) .value_delimiter(':'), ) @@ -1691,7 +1691,7 @@ fn multiple_custom_help_headers() { .required(true) .value_names(&["some", "val"]) .action(ArgAction::Set) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true) .value_delimiter(':'), ) diff --git a/tests/builder/indices.rs b/tests/builder/indices.rs index b670ab63..0e6ad9ba 100644 --- a/tests/builder/indices.rs +++ b/tests/builder/indices.rs @@ -135,7 +135,7 @@ fn indices_mult_opt_value_delim_eq() { Arg::new("option") .short('o') .action(ArgAction::Set) - .use_value_delimiter(true) + .value_delimiter(',') .number_of_values(1..), ) .try_get_matches_from(vec!["myapp", "-o=val1,val2,val3"]) diff --git a/tests/builder/multiple_values.rs b/tests/builder/multiple_values.rs index 2e764315..74072b59 100644 --- a/tests/builder/multiple_values.rs +++ b/tests/builder/multiple_values.rs @@ -643,7 +643,7 @@ fn sep_long_equals() { Arg::new("option") .long("option") .help("multiple options") - .use_value_delimiter(true), + .value_delimiter(','), ) .try_get_matches_from(vec!["", "--option=val1,val2,val3"]); @@ -667,7 +667,7 @@ fn sep_long_space() { Arg::new("option") .long("option") .help("multiple options") - .use_value_delimiter(true), + .value_delimiter(','), ) .try_get_matches_from(vec!["", "--option", "val1,val2,val3"]); @@ -691,7 +691,7 @@ fn sep_short_equals() { Arg::new("option") .short('o') .help("multiple options") - .use_value_delimiter(true), + .value_delimiter(','), ) .try_get_matches_from(vec!["", "-o=val1,val2,val3"]); @@ -715,7 +715,7 @@ fn sep_short_space() { Arg::new("option") .short('o') .help("multiple options") - .use_value_delimiter(true), + .value_delimiter(','), ) .try_get_matches_from(vec!["", "-o", "val1,val2,val3"]); @@ -739,7 +739,7 @@ fn sep_short_no_space() { Arg::new("option") .short('o') .help("multiple options") - .use_value_delimiter(true), + .value_delimiter(','), ) .try_get_matches_from(vec!["", "-oval1,val2,val3"]); @@ -762,7 +762,7 @@ fn sep_positional() { .arg( Arg::new("option") .help("multiple options") - .use_value_delimiter(true), + .value_delimiter(','), ) .try_get_matches_from(vec!["", "val1,val2,val3"]); @@ -833,8 +833,7 @@ fn no_sep() { Arg::new("option") .long("option") .help("multiple options") - .action(ArgAction::Set) - .use_value_delimiter(false), + .action(ArgAction::Set), ) .try_get_matches_from(vec!["", "--option=val1,val2,val3"]); @@ -854,8 +853,7 @@ fn no_sep_positional() { .arg( Arg::new("option") .help("multiple options") - .action(ArgAction::Set) - .use_value_delimiter(false), + .action(ArgAction::Set), ) .try_get_matches_from(vec!["", "val1,val2,val3"]); @@ -876,7 +874,7 @@ fn req_delimiter_long() { Arg::new("option") .long("option") .number_of_values(1..) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true), ) .arg( @@ -914,7 +912,7 @@ fn req_delimiter_long_with_equal() { Arg::new("option") .long("option") .number_of_values(1..) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true), ) .arg( @@ -952,7 +950,7 @@ fn req_delimiter_short_with_space() { Arg::new("option") .short('o') .number_of_values(1..) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true), ) .arg( @@ -990,7 +988,7 @@ fn req_delimiter_short_with_no_space() { Arg::new("option") .short('o') .number_of_values(1..) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true), ) .arg( @@ -1028,7 +1026,7 @@ fn req_delimiter_short_with_equal() { Arg::new("option") .short('o') .number_of_values(1..) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true), ) .arg( @@ -1068,7 +1066,7 @@ fn req_delimiter_complex() { .short('o') .number_of_values(1..) .action(ArgAction::Append) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true), ) .arg(Arg::new("args").number_of_values(1..).index(1)) diff --git a/tests/builder/opts.rs b/tests/builder/opts.rs index 92916731..4d93d7e6 100644 --- a/tests/builder/opts.rs +++ b/tests/builder/opts.rs @@ -339,7 +339,7 @@ fn multiple_vals_pos_arg_delim() { .arg( arg!(o: -o "some opt") .number_of_values(1..) - .use_value_delimiter(true), + .value_delimiter(','), ) .arg(arg!([file] "some file")) .try_get_matches_from(vec!["", "-o", "1,2", "some"]); @@ -365,7 +365,7 @@ fn require_delims_no_delim() { let r = Command::new("mvae") .arg( arg!(o: -o [opt] ... "some opt") - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true), ) .arg(arg!([file] "some file")) @@ -381,7 +381,7 @@ fn require_delims() { .arg( arg!(o: -o "some opt") .number_of_values(1..) - .use_value_delimiter(true) + .value_delimiter(',') .require_value_delimiter(true), ) .arg(arg!([file] "some file"))