Shorten code in get_remove_tags()
This commit is contained in:
parent
227acd492c
commit
397a82f528
1 changed files with 3 additions and 7 deletions
|
@ -75,13 +75,9 @@ pub fn get_add_tags(matches: &ArgMatches) -> Option<Vec<Tag>> {
|
||||||
///
|
///
|
||||||
/// Returns none if the argument was not specified
|
/// Returns none if the argument was not specified
|
||||||
pub fn get_remove_tags(matches: &ArgMatches) -> Option<Vec<Tag>> {
|
pub fn get_remove_tags(matches: &ArgMatches) -> Option<Vec<Tag>> {
|
||||||
if let Some(v) = extract_tags(matches, tag_subcommand_remove_arg_name(), '-') {
|
let rem = tag_subcommand_remove_arg_name();
|
||||||
return Some(v);
|
extract_tags(matches, rem, '+')
|
||||||
} else {
|
.or_else(|| matches.values_of(rem).map(|values| values.map(String::from).collect()))
|
||||||
matches
|
|
||||||
.values_of(tag_subcommand_remove_arg_name())
|
|
||||||
.map(|values| values.map(String::from).collect())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn extract_tags(matches: &ArgMatches, specifier: &str, specchar: char) -> Option<Vec<Tag>> {
|
fn extract_tags(matches: &ArgMatches, specifier: &str, specchar: char) -> Option<Vec<Tag>> {
|
||||||
|
|
Loading…
Reference in a new issue