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