]> git.r.bdr.sh - rbdr/blog/blob - src/command/add.rs
bc1bea0bb06c86f2077b374b7de68a51cbd0cb5b
[rbdr/blog] / src / command / add.rs
1 use std::io::Result;
2 use super::{
3 generate::Generate,
4 sync_down::SyncDown,
5 sync_up::SyncUp,
6 update::Update
7 };
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>> {
19 vec![Box::new(SyncDown::new())]
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>> {
28 vec![
29 Box::new(Update::new()),
30 Box::new(Generate::new()),
31 Box::new(SyncUp::new())
32 ]
33 }
34
35 fn command(&self) -> &'static str {
36 "add"
37 }
38
39 fn help(&self) -> &'static str {
40 "<path_to_post>\t\t\tCreates new blog post"
41 }
42 }