]> git.r.bdr.sh - rbdr/blog/blame_incremental - src/command/sync_down.rs
Add part of the implementation for add
[rbdr/blog] / src / command / sync_down.rs
... / ...
CommitLineData
1use std::fs::create_dir_all;
2use std::io::{Result, Error};
3use crate::configuration::Configuration;
4
5pub struct SyncDown;
6
7impl SyncDown {
8 pub fn new() -> Self {
9 SyncDown
10 }
11}
12
13impl super::Command for SyncDown {
14 fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
15 vec![]
16 }
17
18 fn execute(&self, _: Option<&String>, configuration: &Configuration, command: &String) -> Result<()> {
19 match create_dir_all(&configuration.data_directory) {
20 Ok(_) => {
21 // We only care to show these warnings if this is the primary command.
22 if command == self.command() {
23 println!("WARNING: Sync Down Not yet implemented");
24 }
25 return Ok(())
26 },
27 Err(e) => Err(Error::new(e.kind(), format!("Could not create data directory")))
28 }
29 }
30
31 fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
32 vec![]
33 }
34
35 fn command(&self) -> &'static str {
36 "sync-down"
37 }
38
39 fn help(&self) -> &'static str {
40 "\t\t\t\tPulls from the git remote if configured"
41 }
42}
43