Browse Source

Fix bad optional unwrapping

Samuel W. Flint 3 years ago
parent
commit
a5d9858d18
4 changed files with 10 additions and 6 deletions
  1. 1 1
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. 1 1
      flake.nix
  4. 7 3
      src/main.rs

+ 1 - 1
Cargo.lock

@@ -171,7 +171,7 @@ dependencies = [
 
 [[package]]
 name = "sync-it"
-version = "1.0.0"
+version = "1.0.1"
 dependencies = [
  "clap",
  "home",

+ 1 - 1
Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "sync-it"
-version = "1.0.0"
+version = "1.0.1"
 authors = ["Samuel W. Flint <swflint@flintfam.org>"]
 edition = "2018"
 

+ 1 - 1
flake.nix

@@ -20,7 +20,7 @@
 
             src = ./.;
 
-            cargoSha256 = "o5/gc50YTH0KCtEJY8yM0EqfGqBYZuLdv2JmTo3tcVY=";
+            cargoSha256 = "b3ma+72TI1jHcnllAswCh9bNeatQuM5jQlu922dBVm4=";
 
             meta = with pkgs.stdenv.lib; {
               description = "A simple, customizable synchronization tool.";

+ 7 - 3
src/main.rs

@@ -39,10 +39,14 @@ fn main() {
                         Some(string) => string.to_string(),
                         None => location.file_name().unwrap().to_str().unwrap().to_string()
                     };
-                    let option_strings_in: Vec<&str> = matches.values_of("options").unwrap().collect();
                     let mut option_strings: Vec<String> = Vec::new();
-                    for str_thing in option_strings_in {
-                        option_strings.push(str_thing.to_string())
+                    match matches.values_of("options") {
+                        Some(option_strings_in) => {
+                            for str_thing in option_strings_in {
+                                option_strings.push(str_thing.to_string())
+                            }
+                        },
+                        None => {}
                     }
                     repository::register(&mut configuration, &name, location_string, type_name, option_strings);
                 },