]> git.r.bdr.sh - rbdr/blog/blobdiff - src/command/sync_up.rs
Deal with all lints
[rbdr/blog] / src / command / sync_up.rs
index cf49518e0fea2825fa1e09a4c6db0a7b5510492e..b609c34027c0c7f3e92b1514c65bb5290eb88ed6 100644 (file)
@@ -1,3 +1,5 @@
+use crate::configuration::Configuration;
+use crate::remote::sync_up;
 use std::io::Result;
 
 pub struct SyncUp;
@@ -13,9 +15,21 @@ impl super::Command for SyncUp {
         vec![]
     }
 
-    fn execute(&self, input: Option<&String>) -> Result<()> {
-        println!("Sync Up: {:?}!", input);
-        return Ok(())
+    fn execute(
+        &self,
+        _: Option<&String>,
+        configuration: &Configuration,
+        command: &str,
+    ) -> Result<()> {
+        match sync_up(&configuration.data_directory, &configuration.remote_config) {
+            Ok(()) => {}
+            Err(e) => {
+                if command == self.command() {
+                    return Err(e);
+                }
+            }
+        }
+        Ok(())
     }
 
     fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
@@ -27,6 +41,6 @@ impl super::Command for SyncUp {
     }
 
     fn help(&self) -> &'static str {
-        "\t\t\t\tPushes to the git remote if configured."
+        "\t\t\t\tPushes to the git remote if configured"
     }
 }