]> git.r.bdr.sh - rbdr/blog/blame - src/command/sync_up.rs
Deal with all lints
[rbdr/blog] / src / command / sync_up.rs
CommitLineData
a9c6be41 1use crate::configuration::Configuration;
172f4c88 2use crate::remote::sync_up;
d7fef30a 3use std::io::Result;
d620665f
RBR
4
5pub struct SyncUp;
6
7impl SyncUp {
8 pub fn new() -> Self {
9 SyncUp
10 }
11}
12
13impl super::Command for SyncUp {
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_up(&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 }
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-up"
41 }
42
43 fn help(&self) -> &'static str {
2f579cf4 44 "\t\t\t\tPushes to the git remote if configured"
d620665f
RBR
45 }
46}