tsk/commands/
mod.rs

1use crate::context::AppContext;
2use async_trait::async_trait;
3use std::error::Error;
4
5pub mod add;
6pub mod debug;
7pub mod docker_build;
8pub mod list;
9pub mod quick;
10pub mod run;
11pub mod stop_proxy;
12pub mod stop_server;
13pub mod tasks;
14pub mod templates;
15
16pub use add::AddCommand;
17pub use debug::DebugCommand;
18pub use docker_build::DockerBuildCommand;
19pub use list::ListCommand;
20pub use quick::QuickCommand;
21pub use run::RunCommand;
22pub use stop_proxy::StopProxyCommand;
23pub use stop_server::StopServerCommand;
24pub use tasks::TasksCommand;
25pub use templates::TemplatesCommand;
26
27#[async_trait]
28pub trait Command: Send + Sync {
29    async fn execute(&self, ctx: &AppContext) -> Result<(), Box<dyn Error>>;
30}
31
32#[cfg(test)]
33mod tests {
34    use super::*;
35
36    #[test]
37    fn test_command_trait_is_object_safe() {
38        // This test ensures that the Command trait can be used as a trait object
39        fn _assert_object_safe(_: &dyn Command) {}
40    }
41
42    #[test]
43    fn test_docker_build_command_instantiation() {
44        // Test that DockerBuildCommand can be instantiated
45        let _cmd = DockerBuildCommand {
46            no_cache: false,
47            tech_stack: None,
48            agent: None,
49            project: None,
50            dry_run: false,
51        };
52    }
53}