summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Moroney <darakian@github.com>2022-06-10 14:08:34 -0700
committerJon <darakian@github.com>2022-06-13 08:57:43 -0700
commit39f0c5f530ea108e10265e927c632de168d41abc (patch)
treefacfacee336b5e5da931fe77029f3100e47025fb
parent981d04b4e32f3f693904783732adf23c0c166e41 (diff)
Should resolve #56 and make code more readable
-rw-r--r--src/main.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 6dab7f8..03e5603 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -80,10 +80,18 @@ fn main() {
.help("Minimum file size in bytes to consider."))
.get_matches();
- //let (sender, receiver) = channel();
- let search_dirs: Vec<_> = arguments.values_of("directories").unwrap().collect();
- let ignore_dirs: Vec<_> = arguments.values_of("ignore").unwrap().collect();
- let min_size: u64 = arguments.value_of("Minimum").unwrap().parse::<u64>().unwrap_or(0);
+ let search_dirs: Vec<_> = match arguments.values_of("directories") {
+ Some(dirs) => dirs.collect(),
+ None => vec![],
+ };
+ let ignore_dirs: Vec<_> = match arguments.values_of("ignore") {
+ Some(dirs) => dirs.collect(),
+ None => vec![],
+ };
+ let min_size: u64 = match arguments.value_of("Minimum") {
+ Some(i) => i.parse::<u64>().unwrap_or(0),
+ None => 0,
+ };
let (complete_files, read_errors): (Vec<Fileinfo>, Vec<(_, _)>) =
ddh::deduplicate_dirs(search_dirs, ignore_dirs, min_size);