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