]> git.r.bdr.sh - rbdr/blog/blame - src/command/sync_down.rs
Allow sync up and down
[rbdr/blog] / src / command / sync_down.rs
CommitLineData
172f4c88 1use std::io::{Result};
a9c6be41 2use crate::configuration::Configuration;
172f4c88 3use crate::remote::sync_down;
d620665f
RBR
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
a9c6be41 18 fn execute(&self, _: Option<&String>, configuration: &Configuration, command: &String) -> Result<()> {
172f4c88
RBR
19 if command == self.command() {
20 return sync_down(&configuration.data_directory, &configuration.remote_config);
a9c6be41 21 }
172f4c88 22 return Ok(())
d620665f
RBR
23 }
24
25 fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
26 vec![]
27 }
28
29 fn command(&self) -> &'static str {
30 "sync-down"
31 }
32
33 fn help(&self) -> &'static str {
2f579cf4 34 "\t\t\t\tPulls from the git remote if configured"
d620665f
RBR
35 }
36}
37