mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 06:12:40 +00:00
fix!: Remove stablized unstable-grouped
feature
This commit is contained in:
parent
4b180f8cd0
commit
d5089b2672
3 changed files with 0 additions and 64 deletions
|
@ -93,7 +93,6 @@ string = ["clap_builder/string"] # Allow runtime generated strings
|
|||
|
||||
# In-work features
|
||||
unstable-replace = ["clap_builder/unstable-replace"]
|
||||
unstable-grouped = ["clap_builder/unstable-grouped"]
|
||||
unstable-v5 = ["clap_builder/unstable-v5", "clap_derive?/unstable-v5", "deprecated"]
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -52,7 +52,6 @@ string = [] # Allow runtime generated strings
|
|||
|
||||
# In-work features
|
||||
unstable-replace = []
|
||||
unstable-grouped = []
|
||||
unstable-v5 = ["deprecated"]
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -570,56 +570,6 @@ impl ArgMatches {
|
|||
!self.args.is_empty()
|
||||
}
|
||||
|
||||
/// Get an [`Iterator`] over groups of values of a specific option.
|
||||
///
|
||||
/// specifically grouped by the occurrences of the options.
|
||||
///
|
||||
/// Each group is a `Vec<&str>` containing the arguments passed to a single occurrence
|
||||
/// of the option.
|
||||
///
|
||||
/// If the option doesn't support multiple occurrences, or there was only a single occurrence,
|
||||
/// the iterator will only contain a single item.
|
||||
///
|
||||
/// Returns `None` if the option wasn't present.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If the value is invalid UTF-8.
|
||||
///
|
||||
/// If `id` is not a valid argument or group id.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```rust
|
||||
/// # use clap_builder as clap;
|
||||
/// # use clap::{Command,Arg, ArgAction};
|
||||
/// let m = Command::new("myprog")
|
||||
/// .arg(Arg::new("exec")
|
||||
/// .short('x')
|
||||
/// .num_args(1..)
|
||||
/// .action(ArgAction::Append)
|
||||
/// .value_terminator(";"))
|
||||
/// .get_matches_from(vec![
|
||||
/// "myprog", "-x", "echo", "hi", ";", "-x", "echo", "bye"]);
|
||||
/// let vals: Vec<Vec<&str>> = m.grouped_values_of("exec").unwrap().collect();
|
||||
/// assert_eq!(vals, [["echo", "hi"], ["echo", "bye"]]);
|
||||
/// ```
|
||||
/// [`Iterator`]: std::iter::Iterator
|
||||
#[cfg(feature = "unstable-grouped")]
|
||||
#[cfg_attr(debug_assertions, track_caller)]
|
||||
#[deprecated(
|
||||
since = "4.1.0",
|
||||
note = "Use get_occurrences or remove_occurrences instead"
|
||||
)]
|
||||
#[allow(deprecated)]
|
||||
pub fn grouped_values_of(&self, id: &str) -> Option<GroupedValues> {
|
||||
let arg = some!(self.get_arg(id));
|
||||
let v = GroupedValues {
|
||||
iter: arg.vals().map(|g| g.iter().map(unwrap_string).collect()),
|
||||
len: arg.vals().len(),
|
||||
};
|
||||
Some(v)
|
||||
}
|
||||
|
||||
/// Report where argument value came from
|
||||
///
|
||||
/// # Panics
|
||||
|
@ -1907,18 +1857,6 @@ impl<'a> Default for Indices<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(debug_assertions, track_caller)]
|
||||
#[inline]
|
||||
#[cfg(feature = "unstable-grouped")]
|
||||
fn unwrap_string(value: &AnyValue) -> &str {
|
||||
match value.downcast_ref::<String>() {
|
||||
Some(value) => value,
|
||||
None => {
|
||||
panic!("Must use `_os` lookups with `Arg::allow_invalid_utf8`",)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn unwrap_downcast_ref<T: Any + Clone + Send + Sync + 'static>(value: &AnyValue) -> &T {
|
||||
value.downcast_ref().expect(INTERNAL_ERROR_MSG)
|
||||
|
|
Loading…
Reference in a new issue