]> git.r.bdr.sh - rbdr/blog/blame_incremental - src/command/mod.rs
Add CI
[rbdr/blog] / src / command / mod.rs
... / ...
CommitLineData
1pub mod add;
2pub mod generate;
3pub mod update;
4pub mod publish;
5pub mod publish_archive;
6pub mod add_remote;
7pub mod remove_remote;
8pub mod sync_up;
9pub mod sync_down;
10pub mod status;
11pub mod version;
12pub mod help;
13
14
15use std::io::Result;
16
17use add::Add;
18use generate::Generate;
19use update::Update;
20use publish::Publish;
21use publish_archive::PublishArchive;
22use add_remote::AddRemote;
23use remove_remote::RemoveRemote;
24use sync_up::SyncUp;
25use sync_down::SyncDown;
26use version::Version;
27use status::Status;
28use help::Help;
29
30use crate::configuration::Configuration;
31
32pub trait Command {
33 fn before_dependencies(&self) -> Vec<Box<dyn Command>>;
34 fn execute(&self, input: Option<&String>, configuration: &Configuration, command: &String) -> Result<()>;
35 fn after_dependencies(&self) -> Vec<Box<dyn Command>>;
36 fn command(&self) -> &'static str;
37 fn help(&self) -> &'static str;
38}
39
40pub fn available_commands() -> Vec<Box<dyn Command>> {
41 vec![
42 Box::new(Add::new()),
43 Box::new(Generate::new()),
44 Box::new(Update::new()),
45 Box::new(Publish::new()),
46 Box::new(PublishArchive::new()),
47 Box::new(AddRemote::new()),
48 Box::new(RemoveRemote::new()),
49 Box::new(SyncUp::new()),
50 Box::new(SyncDown::new()),
51 Box::new(Status::new()),
52 Box::new(Version::new()),
53 Box::new(Help::new())
54 ]
55}