]> git.r.bdr.sh - rbdr/blog/blame - src/command/add_remote.rs
Allow sync up and down
[rbdr/blog] / src / command / add_remote.rs
CommitLineData
d620665f 1use std::io::Result;
a9c6be41 2use crate::configuration::Configuration;
172f4c88 3use crate::remote::add;
d620665f
RBR
4
5pub struct AddRemote;
6
7impl AddRemote {
8 pub fn new() -> Self {
9 AddRemote
10 }
11}
12
13impl super::Command for AddRemote {
14 fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
15 vec![]
16 }
17
36a4680d 18 fn execute(&self, input: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
36a4680d 19 let input = input.expect("You must provide a location for the remote.");
172f4c88 20 add(&configuration.config_directory, &configuration.remote_config, input)
d620665f
RBR
21 }
22
23 fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
24 vec![]
25 }
26
27 fn command(&self) -> &'static str {
28 "add-remote"
29 }
30
31 fn help(&self) -> &'static str {
32 "<git_url>\t\tAdds or updates a git remote to sync with"
33 }
34}