diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-03-09 14:17:34 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-03-09 14:17:34 +0100 |
| commit | 172f4c8807d44ebe38c7f227b7fdc2d6a9dbe323 (patch) | |
| tree | b880761cf254fbc668cea0d577d5331a28af67cc /src/command/sync_down.rs | |
| parent | 36a4680d18de012e2e5c732f9db161dafa884344 (diff) | |
Allow sync up and down
Diffstat (limited to 'src/command/sync_down.rs')
| -rw-r--r-- | src/command/sync_down.rs | 16 |
1 files changed, 5 insertions, 11 deletions
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<Box<dyn super::Command>> { |