use std::io::{Error, ErrorKind::Other, Result}; use crate::configuration::Configuration; use crate::remote::add; pub struct AddRemote; impl AddRemote { pub fn new() -> Self { AddRemote } } impl super::Command for AddRemote { fn before_dependencies(&self) -> Vec> { vec![] } 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> { vec![] } fn command(&self) -> &'static str { "add-remote" } fn help(&self) -> &'static str { "\t\tAdds or updates a git remote to sync with" } }