]>
Commit | Line | Data |
---|---|---|
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; | |
10 | pub mod version; | |
11 | pub mod help; | |
12 | ||
13 | use std::io::Result; | |
14 | ||
15 | use add::Add; | |
16 | use generate::Generate; | |
17 | use update::Update; | |
18 | use publish::Publish; | |
19 | use publish_archive::PublishArchive; | |
20 | use add_remote::AddRemote; | |
21 | use remove_remote::RemoveRemote; | |
22 | use sync_up::SyncUp; | |
23 | use sync_down::SyncDown; | |
24 | use version::Version; | |
25 | use help::Help; | |
26 | ||
27 | pub trait Command { | |
28 | fn before_dependencies(&self) -> Vec<Box<dyn Command>>; | |
29 | fn execute(&self, input: Option<&String>) -> Result<()>; | |
30 | fn after_dependencies(&self) -> Vec<Box<dyn Command>>; | |
31 | fn command(&self) -> &'static str; | |
32 | fn help(&self) -> &'static str; | |
33 | } | |
34 | ||
35 | pub fn available_commands() -> Vec<Box<dyn Command>> { | |
36 | vec![ | |
37 | Box::new(Add::new()), | |
38 | Box::new(Generate::new()), | |
39 | Box::new(Update::new()), | |
40 | Box::new(Publish::new()), | |
41 | Box::new(PublishArchive::new()), | |
42 | Box::new(AddRemote::new()), | |
43 | Box::new(RemoveRemote::new()), | |
44 | Box::new(SyncUp::new()), | |
45 | Box::new(SyncDown::new()), | |
46 | Box::new(Version::new()), | |
47 | Box::new(Help::new()) | |
48 | ] | |
49 | } |