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