mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 23:02:31 +00:00
Merge branch 'vin-issue-205'
This commit is contained in:
commit
2e2baba226
3 changed files with 11 additions and 11 deletions
|
@ -36,7 +36,7 @@ fn main() {
|
|||
// Create a group, make it required, and add the above arguments
|
||||
.arg_group(ArgGroup::with_name("vers")
|
||||
.required(true)
|
||||
.add_all(vec!["vers", "major", "minor", "patch"]))
|
||||
.add_all(&["vers", "major", "minor", "patch"]))
|
||||
// Arguments can also be added to a group individually, these two arguments
|
||||
// are part of the "input" group which is not required
|
||||
.arg(Arg::from_usage("[INPUT_FILE] 'some regular input'").group("input"))
|
||||
|
|
|
@ -1074,7 +1074,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
|||
/// --minor 'auto increase minor'
|
||||
/// --patch 'auto increase patch")
|
||||
/// .arg_group(ArgGroup::with_name("vers")
|
||||
/// .add_all(vec!["ver", "major", "minor","patch"])
|
||||
/// .add_all(&["ver", "major", "minor","patch"])
|
||||
/// .required(true))
|
||||
/// # ;
|
||||
pub fn arg_group(mut self, group: ArgGroup<'ar, 'ar>) -> Self {
|
||||
|
@ -1136,7 +1136,7 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
|||
/// --minor 'auto increase minor'
|
||||
/// --patch 'auto increase patch")
|
||||
/// .arg_group(ArgGroup::with_name("vers")
|
||||
/// .add_all(vec!["ver", "major", "minor","patch"])
|
||||
/// .add_all(&["ver", "major", "minor","patch"])
|
||||
/// .required(true))
|
||||
/// # ;
|
||||
pub fn arg_groups(mut self, groups: Vec<ArgGroup<'ar, 'ar>>) -> Self {
|
||||
|
|
|
@ -39,7 +39,7 @@ use yaml_rust::Yaml;
|
|||
/// --minor 'auto increase minor'
|
||||
/// --patch 'auto increase patch")
|
||||
/// .arg_group(ArgGroup::with_name("vers")
|
||||
/// .add_all(vec!["ver", "major", "minor","patch"])
|
||||
/// .add_all(&["ver", "major", "minor","patch"])
|
||||
/// .required(true))
|
||||
/// # .get_matches();
|
||||
pub struct ArgGroup<'n, 'ar> {
|
||||
|
@ -145,7 +145,7 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
|
|||
self
|
||||
}
|
||||
|
||||
/// Adds multiple arguments to this group by name using a Vec
|
||||
/// Adds multiple arguments to this group by name
|
||||
///
|
||||
///
|
||||
/// # Example
|
||||
|
@ -155,9 +155,9 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
|
|||
/// # let matches = App::new("myprog")
|
||||
/// # .arg_group(
|
||||
/// # ArgGroup::with_name("conifg")
|
||||
/// .add_all(vec!["config", "input", "output"])
|
||||
/// .add_all(&["config", "input", "output"])
|
||||
/// # ).get_matches();
|
||||
pub fn add_all(mut self, ns: Vec<&'ar str>) -> Self {
|
||||
pub fn add_all(mut self, ns: &[&'ar str]) -> Self {
|
||||
for n in ns {
|
||||
self = self.add(n);
|
||||
}
|
||||
|
@ -225,9 +225,9 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
|
|||
/// # let matches = App::new("myprog")
|
||||
/// # .arg_group(
|
||||
/// # ArgGroup::with_name("conifg")
|
||||
/// .requires_all(vec!["config", "input"])
|
||||
/// .requires_all(&["config", "input"])
|
||||
/// # ).get_matches();
|
||||
pub fn requires_all(mut self, ns: Vec<&'ar str>) -> Self {
|
||||
pub fn requires_all(mut self, ns: &[&'ar str]) -> Self {
|
||||
for n in ns {
|
||||
self = self.requires(n);
|
||||
}
|
||||
|
@ -275,9 +275,9 @@ impl<'n, 'ar> ArgGroup<'n, 'ar> {
|
|||
/// # let matches = App::new("myprog")
|
||||
/// # .arg_group(
|
||||
/// # ArgGroup::with_name("conifg")
|
||||
/// .conflicts_with_all(vec!["config", "input"])
|
||||
/// .conflicts_with_all(&["config", "input"])
|
||||
/// # ).get_matches();
|
||||
pub fn conflicts_with_all(mut self, ns: Vec<&'ar str>) -> Self {
|
||||
pub fn conflicts_with_all(mut self, ns: &[&'ar str]) -> Self {
|
||||
for n in ns {
|
||||
self = self.conflicts_with(n);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue