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