]> git.r.bdr.sh - rbdr/blog/blobdiff - src/command/add_remote.rs
Allow sync up and down
[rbdr/blog] / src / command / add_remote.rs
index ad7be83db4b4c41ef0109f25256cf4d2708534e7..040e5729b25201ce0160433f1170635a8097b987 100644 (file)
@@ -1,6 +1,6 @@
-use std::fs::{create_dir_all, write};
 use std::io::Result;
 use crate::configuration::Configuration;
+use crate::remote::add;
 
 pub struct AddRemote;
 
@@ -16,10 +16,8 @@ impl super::Command for AddRemote {
     }
 
     fn execute(&self, input: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
-        create_dir_all(&configuration.config_directory)?;
         let input = input.expect("You must provide a location for the remote.");
-        write(&configuration.remote_config, input)?;
-        return Ok(())
+        add(&configuration.config_directory, &configuration.remote_config, input)
     }
 
     fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {