aboutsummaryrefslogtreecommitdiff
path: root/src/command/sync_down.rs
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2024-02-25 22:06:19 +0000
committerRuben Beltran del Rio <git@r.bdr.sh>2024-02-25 22:06:19 +0000
commita9c6be4162bd15bd41ba3605127b56cb1eb32f32 (patch)
tree6d97b0c6286b1eabb2ef5cab34b472f1622584e5 /src/command/sync_down.rs
parent53812065cf124b6c1bc40fceec46f8c161033e29 (diff)
Add part of the implementation for add
Diffstat (limited to 'src/command/sync_down.rs')
-rw-r--r--src/command/sync_down.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/command/sync_down.rs b/src/command/sync_down.rs
index c00b01a..dc4114e 100644
--- a/src/command/sync_down.rs
+++ b/src/command/sync_down.rs
@@ -1,4 +1,6 @@
-use std::io::Result;
+use std::fs::create_dir_all;
+use std::io::{Result, Error};
+use crate::configuration::Configuration;
pub struct SyncDown;
@@ -13,9 +15,17 @@ impl super::Command for SyncDown {
vec![]
}
- fn execute(&self, input: Option<&String>) -> Result<()> {
- println!("Sync Down: {:?}!", input);
- return Ok(())
+ 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")))
+ }
}
fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {