X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/a9c6be4162bd15bd41ba3605127b56cb1eb32f32..b17907faf8d9693cef94a6048d802bd4ced9102f:/src/command/add_remote.rs diff --git a/src/command/add_remote.rs b/src/command/add_remote.rs index c98330f..e5ca591 100644 --- a/src/command/add_remote.rs +++ b/src/command/add_remote.rs @@ -1,5 +1,6 @@ -use std::io::Result; use crate::configuration::Configuration; +use crate::remote::add; +use std::io::{Error, ErrorKind::Other, Result}; pub struct AddRemote; @@ -14,9 +15,19 @@ impl super::Command for AddRemote { vec![] } - fn execute(&self, input: Option<&String>, _: &Configuration, _: &String) -> Result<()> { - println!("Add Remote: {:?}!", input); - return Ok(()) + fn execute( + &self, + input: Option<&String>, + configuration: &Configuration, + _: &str, + ) -> Result<()> { + 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, + ) } fn after_dependencies(&self) -> Vec> {