]>
Commit | Line | Data |
---|---|---|
d620665f | 1 | use std::io::Result; |
5f81d796 RBR |
2 | use super::{ |
3 | generate::Generate, | |
4 | sync_down::SyncDown, | |
5 | sync_up::SyncUp, | |
6 | update::Update | |
7 | }; | |
d620665f RBR |
8 | |
9 | pub struct Add; | |
10 | ||
11 | impl Add { | |
12 | pub fn new() -> Self { | |
13 | Add | |
14 | } | |
15 | } | |
16 | ||
17 | impl super::Command for Add { | |
18 | fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> { | |
5f81d796 | 19 | vec![Box::new(SyncDown::new())] |
d620665f RBR |
20 | } |
21 | ||
22 | fn execute(&self, input: Option<&String>) -> Result<()> { | |
23 | println!("Add: {:?}!", input); | |
24 | return Ok(()) | |
25 | } | |
26 | ||
27 | fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> { | |
5f81d796 RBR |
28 | vec![ |
29 | Box::new(Update::new()), | |
30 | Box::new(Generate::new()), | |
31 | Box::new(SyncUp::new()) | |
32 | ] | |
d620665f RBR |
33 | } |
34 | ||
35 | fn command(&self) -> &'static str { | |
36 | "add" | |
37 | } | |
38 | ||
39 | fn help(&self) -> &'static str { | |
2f579cf4 | 40 | "<path_to_post>\t\t\tCreates new blog post" |
d620665f RBR |
41 | } |
42 | } |