X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/d620665f6b2e1ae5db4c98a09e35bd63133ae87f..50f53dc480fda8b3daab7a34454c2dd9f3f5f991:/src/command/sync_down.rs diff --git a/src/command/sync_down.rs b/src/command/sync_down.rs index a0c713b..eb8e57a 100644 --- a/src/command/sync_down.rs +++ b/src/command/sync_down.rs @@ -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(()) } @@ -27,7 +36,7 @@ impl super::Command for SyncDown { } fn help(&self) -> &'static str { - "\t\t\tPulls from the git remote if configured" + "\t\t\t\tPulls from the git remote if configured" } }