+use std::fs::{create_dir_all, write};
use std::io::Result;
use crate::configuration::Configuration;
vec![]
}
- fn execute(&self, input: Option<&String>, _: &Configuration, _: &String) -> Result<()> {
- println!("Add Remote: {:?}!", input);
+ 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(())
}
+use std::fs::remove_file;
use std::io::Result;
use crate::configuration::Configuration;
vec![]
}
- fn execute(&self, input: Option<&String>, _: &Configuration, _: &String) -> Result<()> {
- println!("Remove Remote: {:?}!", input);
+ fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
+ if configuration.remote_config.exists() {
+ remove_file(&configuration.remote_config)?;
+ }
return Ok(())
}