Clap: use default_value on input

This avoids uses one less 'match' statement
This commit is contained in:
andy.boot
2021-09-19 08:39:23 +01:00
parent 9d2e6d2b36
commit d6c2482150
+5 -7
View File
@@ -205,15 +205,13 @@ fn main() {
.number_of_values(1) .number_of_values(1)
.help("Specify width of output overriding the auto detection of terminal width"), .help("Specify width of output overriding the auto detection of terminal width"),
) )
.arg(Arg::with_name("inputs").multiple(true)) .arg(Arg::with_name("inputs").multiple(true).default_value("."))
.get_matches(); .get_matches();
let target_dirs = { let target_dirs = options
match options.values_of("inputs") { .values_of("inputs")
None => vec!["."], .expect("Should be a default value here")
Some(r) => r.collect(), .collect();
}
};
let summarize_file_types = options.is_present("types"); let summarize_file_types = options.is_present("types");