]> git.r.bdr.sh - rbdr/blog/blob - src/command/update.rs
0a0211cbae485729691120850c88dca78c01a4f9
[rbdr/blog] / src / command / update.rs
1 use std::io::Result;
2 use super::{sync_down::SyncDown, generate::Generate, sync_up::SyncUp};
3
4 pub struct Update;
5
6 impl Update {
7 pub fn new() -> Self {
8 Update
9 }
10 }
11
12 impl super::Command for Update {
13 fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
14 vec![Box::new(SyncDown::new())]
15 }
16
17 fn execute(&self, input: Option<&String>) -> Result<()> {
18 println!("Update: {:?}!", input);
19 return Ok(())
20 }
21
22 fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
23 vec![
24 Box::new(Generate::new()),
25 Box::new(SyncUp::new())
26 ]
27 }
28
29 fn command(&self) -> &'static str {
30 "update"
31 }
32
33 fn help(&self) -> &'static str {
34 "<path_to_post>\t\tUpdates latest blog post"
35 }
36 }
37