diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-02-23 20:37:39 +0000 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-02-23 20:37:39 +0000 |
| commit | d620665f6b2e1ae5db4c98a09e35bd63133ae87f (patch) | |
| tree | 964bf044d3e1ae880c65d252e7c702f81874f2bc /src/command/mod.rs | |
| parent | 72c91149425d45b0517bda929d459fc02f5603cc (diff) | |
Add logic skeleton for rust version
Diffstat (limited to 'src/command/mod.rs')
| -rw-r--r-- | src/command/mod.rs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/command/mod.rs b/src/command/mod.rs new file mode 100644 index 0000000..c207754 --- /dev/null +++ b/src/command/mod.rs @@ -0,0 +1,49 @@ +pub mod add; +pub mod generate; +pub mod update; +pub mod publish; +pub mod publish_archive; +pub mod add_remote; +pub mod remove_remote; +pub mod sync_up; +pub mod sync_down; +pub mod version; +pub mod help; + +use std::io::Result; + +use add::Add; +use generate::Generate; +use update::Update; +use publish::Publish; +use publish_archive::PublishArchive; +use add_remote::AddRemote; +use remove_remote::RemoveRemote; +use sync_up::SyncUp; +use sync_down::SyncDown; +use version::Version; +use help::Help; + +pub trait Command { + fn before_dependencies(&self) -> Vec<Box<dyn Command>>; + fn execute(&self, input: Option<&String>) -> 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(Version::new()), + Box::new(Help::new()) + ] +} |