Change get_remove_tags() to get to-remove-tags from top level if there are any

This commit is contained in:
Matthias Beyer 2016-05-18 22:28:15 +02:00
parent c6821a53ca
commit ed724d3726

View file

@ -79,7 +79,13 @@ 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>> {
extract_tags(matches, "remove-tags", '-') if let Some(v) = extract_tags(matches, tag_subcommand_remove_arg_name(), '-') {
return Some(v);
} else {
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>> {