Shorten code in get_add_tags()
This commit is contained in:
parent
435fd6d7aa
commit
227acd492c
1 changed files with 3 additions and 7 deletions
|
@ -66,13 +66,9 @@ pub fn tag_argument_name() -> &'static str {
|
|||
///
|
||||
/// Returns none if the argument was not specified
|
||||
pub fn get_add_tags(matches: &ArgMatches) -> Option<Vec<Tag>> {
|
||||
if let Some(v) = extract_tags(matches, tag_subcommand_add_arg_name(), '+') {
|
||||
return Some(v);
|
||||
} else {
|
||||
matches
|
||||
.values_of(tag_subcommand_add_arg_name())
|
||||
.map(|values| values.map(String::from).collect())
|
||||
}
|
||||
let add = tag_subcommand_add_arg_name();
|
||||
extract_tags(matches, add, '+')
|
||||
.or_else(|| matches.values_of(add).map(|values| values.map(String::from).collect()))
|
||||
}
|
||||
|
||||
/// Get the tags which should be removed from the commandline
|
||||
|
|
Loading…
Reference in a new issue