Skip to content

Commit

Permalink
Clap: use default_value on input
Browse files Browse the repository at this point in the history
This avoids uses one less 'match' statement
  • Loading branch information
bootandy committed Sep 19, 2021
1 parent 9d2e6d2 commit d6c2482
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,13 @@ fn main() {
.number_of_values(1)
.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();

let target_dirs = {
match options.values_of("inputs") {
None => vec!["."],
Some(r) => r.collect(),
}
};
let target_dirs = options
.values_of("inputs")
.expect("Should be a default value here")
.collect();

let summarize_file_types = options.is_present("types");

Expand Down

0 comments on commit d6c2482

Please sign in to comment.