torrust_tracker_deployer_lib/presentation/cli/controllers/test/mod.rs
1//! Test Command Presentation Module
2//!
3//! This module implements the CLI presentation layer for the test command,
4//! handling argument processing and user interaction.
5//!
6//! ## Architecture
7//!
8//! The test command presentation layer follows the DDD pattern, orchestrating
9//! the application layer's `TestCommandHandler` while providing user-friendly
10//! output and error handling.
11//!
12//! ## Components
13//!
14//! - `errors` - Presentation layer error types with `.help()` methods
15//! - `handler` - Main command handler orchestrating the workflow
16//!
17//! ## Usage Example
18//!
19//! ### Basic Usage
20//!
21//! ```ignore
22//! use std::path::Path;
23//! use std::sync::Arc;
24//! use torrust_tracker_deployer_lib::bootstrap::Container;
25//! use torrust_tracker_deployer_lib::presentation::cli::dispatch::ExecutionContext;
26//! use torrust_tracker_deployer_lib::presentation::cli::controllers::test;
27//! use torrust_tracker_deployer_lib::presentation::cli::views::VerbosityLevel;
28//!
29//! # #[tokio::main]
30//! # async fn main() {
31//! let container = Container::new(VerbosityLevel::Normal, Path::new("."));
32//! let context = ExecutionContext::new(Arc::new(container), global_args);
33//!
34//! // Call the test handler
35//! if let Err(e) = context
36//! .container()
37//! .create_test_controller()
38//! .execute("my-environment")
39//! .await
40//! {
41//! eprintln!("Test failed: {e}");
42//! eprintln!("\n{}", e.help());
43//! }
44//! # }
45//! ```
46//!
47//! ## Direct Usage (For Testing)
48//!
49//! ```ignore
50//! use std::path::Path;
51//! use std::sync::Arc;
52//! use torrust_tracker_deployer_lib::bootstrap::Container;
53//! use torrust_tracker_deployer_lib::presentation::cli::dispatch::ExecutionContext;
54//! use torrust_tracker_deployer_lib::presentation::cli::controllers::test;
55//! use torrust_tracker_deployer_lib::presentation::cli::views::VerbosityLevel;
56//!
57//! # #[tokio::main]
58//! # async fn main() {
59//! let container = Container::new(VerbosityLevel::Normal, Path::new("."));
60//! let context = ExecutionContext::new(Arc::new(container), global_args);
61//!
62//! if let Err(e) = context
63//! .container()
64//! .create_test_controller()
65//! .execute("test-env")
66//! .await
67//! {
68//! eprintln!("Test failed: {e}");
69//! eprintln!("\n{}", e.help());
70//! }
71//! # }
72//! ```
73
74pub mod errors;
75pub mod handler;
76pub use handler::TestCommandController;
77
78#[cfg(test)]
79mod tests;
80
81// Re-export commonly used types for convenience
82pub use errors::TestSubcommandError;