]>
Commit | Line | Data |
---|---|---|
d620665f RBR |
1 | pub mod add; |
2 | pub mod generate; | |
3 | pub mod update; | |
4 | pub mod publish; | |
5 | pub mod publish_archive; | |
6 | pub mod add_remote; | |
7 | pub mod remove_remote; | |
8 | pub mod sync_up; | |
9 | pub mod sync_down; | |
5f81d796 | 10 | pub mod status; |
d620665f RBR |
11 | pub mod version; |
12 | pub mod help; | |
13 | ||
5f81d796 | 14 | |
d620665f RBR |
15 | use std::io::Result; |
16 | ||
17 | use add::Add; | |
18 | use generate::Generate; | |
19 | use update::Update; | |
20 | use publish::Publish; | |
21 | use publish_archive::PublishArchive; | |
22 | use add_remote::AddRemote; | |
23 | use remove_remote::RemoveRemote; | |
24 | use sync_up::SyncUp; | |
25 | use sync_down::SyncDown; | |
26 | use version::Version; | |
5f81d796 | 27 | use status::Status; |
d620665f RBR |
28 | use help::Help; |
29 | ||
a9c6be41 RBR |
30 | use crate::configuration::Configuration; |
31 | ||
d620665f RBR |
32 | pub trait Command { |
33 | fn before_dependencies(&self) -> Vec<Box<dyn Command>>; | |
a9c6be41 | 34 | fn execute(&self, input: Option<&String>, configuration: &Configuration, command: &String) -> Result<()>; |
d620665f RBR |
35 | fn after_dependencies(&self) -> Vec<Box<dyn Command>>; |
36 | fn command(&self) -> &'static str; | |
37 | fn help(&self) -> &'static str; | |
38 | } | |
39 | ||
40 | pub 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()), | |
5f81d796 | 51 | Box::new(Status::new()), |
d620665f RBR |
52 | Box::new(Version::new()), |
53 | Box::new(Help::new()) | |
54 | ] | |
55 | } |