]> git.r.bdr.sh - rbdr/blog/blobdiff - src/command/add_remote.rs
Manually import
[rbdr/blog] / src / command / add_remote.rs
index 040e5729b25201ce0160433f1170635a8097b987..e9157f3a5b8208fe83a08c5ed47d7784f7673ea7 100644 (file)
@@ -1,4 +1,4 @@
-use std::io::Result;
+use std::io::{Error, ErrorKind::Other, Result};
 use crate::configuration::Configuration;
 use crate::remote::add;
 
 use crate::configuration::Configuration;
 use crate::remote::add;
 
@@ -16,7 +16,8 @@ impl super::Command for AddRemote {
     }
 
     fn execute(&self, input: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
     }
 
     fn execute(&self, input: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
-        let input = input.expect("You must provide a location for the remote.");
+        let input = input
+            .ok_or_else(|| Error::new(Other, "You must provide a location for the remote."))?;
         add(&configuration.config_directory, &configuration.remote_config, input)
     }
 
         add(&configuration.config_directory, &configuration.remote_config, input)
     }