updated behaviour of --disable flag to not error out on unrecognized values
@@ -449,13 +449,6 @@ fn main() -> Result<()> {
.multiple(true)
.takes_value(true)
.case_insensitive(true)
- .possible_values(&InfoFields::iter()
- .take(InfoFields::count() - 1)
- .map(|field| field.into())
- .collect::<Vec<&str>>()
- .as_slice())
- .possible_value("")
- .hide_possible_values(true)
.default_value("")
.hide_default_value(true)
.help(&format!("Disable fields to show\nPossible values: {:?}",
@@ -516,18 +509,15 @@ Possible values: [{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}]",
.unwrap()
.to_lowercase())
.unwrap_or(Language::Unknown);
- let disable_fields: Vec<InfoFields> = if let Some(values) = matches.values_of("disable_field") {
- values
+ let disable_fields: Vec<InfoFields> = matches.values_of("disable_field")
+ .unwrap()
.map(String::from)
.filter_map(|field: String| {
let item = InfoFields::from_str(field.to_lowercase().as_str())
.unwrap_or(InfoFields::UnrecognizedField);
if item == InfoFields::UnrecognizedField { None } else { Some(item) }
})
- .collect()
- } else {
- Vec::new()
- };
+ .collect();
let tokei_langs = project_languages(&dir);
let languages_stat = get_languages_stat(&tokei_langs).ok_or(Error::SourceCodeNotFound)?;
