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