-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmod.rs
More file actions
57 lines (54 loc) · 2.09 KB
/
mod.rs
File metadata and controls
57 lines (54 loc) · 2.09 KB
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
//! Create Command Presentation Module
//!
//! This module implements the CLI presentation layer for the create command,
//! handling Figment integration for configuration file parsing, argument
//! processing, and user interaction.
//!
//! ## Architecture
//!
//! The create command presentation layer follows the existing patterns from
//! the destroy command and integrates with the application layer's
//! `CreateCommandHandler`. Figment is used as a delivery mechanism and stays
//! in the presentation layer following DDD boundaries.
//!
//! ## Components
//!
//! - `router` - Main command router routing between subcommands
//! - `subcommands` - Individual subcommand implementations (environment, template)
//! - `environment` - Contains environment creation logic, error types, and config loading
//! - `errors` - Unified error types for all create subcommands
//!
//! ## Usage Example
//!
//! ```ignore
//! use std::path::{Path, PathBuf};
//! use std::sync::{Arc, Mutex};
//! use torrust_tracker_deployer_lib::presentation::cli::input::cli::commands::CreateAction;
//! use torrust_tracker_deployer_lib::presentation::cli::controllers::create;
//! use torrust_tracker_deployer_lib::presentation::cli::dispatch::ExecutionContext;
//!
//! # #[tokio::main]
//! # async fn main() {
//! let action = CreateAction::Environment {
//! env_file: PathBuf::from("config/environment.json")
//! };
//! // Note: ExecutionContext would be provided by the application bootstrap
//! # let context = todo!(); // Mock for documentation example
//!
//! if let Err(e) = create::route_command(action, Path::new("."), &context).await {
//! eprintln!("Create failed: {e}");
//! eprintln!("\n{}", e.help());
//! }
//! # }
//! ```
pub mod errors;
pub mod router;
pub mod subcommands;
#[cfg(test)]
mod tests;
// Re-export commonly used types for convenience
pub use errors::CreateCommandError;
pub use router::route_command;
pub use subcommands::environment::{ConfigFormat, ConfigLoader, CreateEnvironmentCommandError};
pub use subcommands::schema::CreateSchemaCommandError;
pub use subcommands::template::CreateEnvironmentTemplateCommandError;