X-Git-Url: https://git.r.bdr.sh/rbdr/blog/blobdiff_plain/a9c6be4162bd15bd41ba3605127b56cb1eb32f32..898192d46a0012f77f07afba7145b96d734a707c:/src/command/sync_down.rs?ds=sidebyside diff --git a/src/command/sync_down.rs b/src/command/sync_down.rs index dc4114e..eb8e57a 100644 --- a/src/command/sync_down.rs +++ b/src/command/sync_down.rs @@ -1,6 +1,6 @@ -use std::fs::create_dir_all; -use std::io::{Result, Error}; +use std::io::{Result}; use crate::configuration::Configuration; +use crate::remote::sync_down; pub struct SyncDown; @@ -16,16 +16,15 @@ impl super::Command for SyncDown { } fn execute(&self, _: Option<&String>, configuration: &Configuration, command: &String) -> Result<()> { - match create_dir_all(&configuration.data_directory) { - Ok(_) => { - // We only care to show these warnings if this is the primary command. + match sync_down(&configuration.data_directory, &configuration.remote_config) { + Ok(_) => {} + Err(e) => { if command == self.command() { - println!("WARNING: Sync Down Not yet implemented"); + return Err(e) } - return Ok(()) - }, - Err(e) => Err(Error::new(e.kind(), format!("Could not create data directory"))) + } } + return Ok(()) } fn after_dependencies(&self) -> Vec> {