From 172f4c8807d44ebe38c7f227b7fdc2d6a9dbe323 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sat, 9 Mar 2024 14:17:34 +0100 Subject: Allow sync up and down --- src/command/sync_down.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/command/sync_down.rs') diff --git a/src/command/sync_down.rs b/src/command/sync_down.rs index dc4114e..bba34b2 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,10 @@ 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. - if command == self.command() { - println!("WARNING: Sync Down Not yet implemented"); - } - return Ok(()) - }, - Err(e) => Err(Error::new(e.kind(), format!("Could not create data directory"))) + if command == self.command() { + return sync_down(&configuration.data_directory, &configuration.remote_config); } + return Ok(()) } fn after_dependencies(&self) -> Vec> { -- cgit