]> git.r.bdr.sh - rbdr/blog/blobdiff - src/command/sync_down.rs
Add release
[rbdr/blog] / src / command / sync_down.rs
index c00b01a90aecdfa6822e21a063789aba81120511..eb8e57afdf0b01c0b9b28cedb76eb0541608e922 100644 (file)
@@ -1,4 +1,6 @@
-use std::io::Result;
+use std::io::{Result};
+use crate::configuration::Configuration;
+use crate::remote::sync_down;
 
 pub struct SyncDown;
 
@@ -13,8 +15,15 @@ impl super::Command for SyncDown {
         vec![]
     }
 
-    fn execute(&self, input: Option<&String>) -> Result<()> {
-        println!("Sync Down: {:?}!", input);
+    fn execute(&self, _: Option<&String>, configuration: &Configuration, command: &String) -> Result<()> {
+        match sync_down(&configuration.data_directory, &configuration.remote_config) {
+            Ok(_) => {}
+            Err(e) => {
+                if command == self.command() {
+                    return Err(e)
+                }
+            }
+        }
         return Ok(())
     }