-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmod.rs
More file actions
52 lines (49 loc) · 1.84 KB
/
Copy pathmod.rs
File metadata and controls
52 lines (49 loc) · 1.84 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
//! 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
//!
//! - `config_loader` - Figment integration for JSON configuration loading
//! - `errors` - Presentation layer error types with `.help()` methods
//! - `handler` - Main command handler routing between subcommands
//! - `subcommands` - Individual subcommand implementations (environment, template)
//!
//! ## Usage Example
//!
//! ```rust,no_run
//! use std::path::{Path, PathBuf};
//! use std::sync::{Arc, Mutex};
//! use torrust_tracker_deployer_lib::presentation::cli::commands::CreateAction;
//! use torrust_tracker_deployer_lib::presentation::commands::create;
//! use torrust_tracker_deployer_lib::presentation::user_output::{UserOutput, VerbosityLevel};
//!
//! let action = CreateAction::Environment {
//! env_file: PathBuf::from("config/environment.json")
//! };
//! let output = Arc::new(Mutex::new(UserOutput::new(VerbosityLevel::Normal)));
//!
//! if let Err(e) = create::handle_create_command(action, Path::new("."), &output) {
//! eprintln!("Create failed: {e}");
//! eprintln!("\n{}", e.help());
//! }
//! ```
pub mod config_loader;
pub mod errors;
pub mod handler;
pub mod subcommands;
#[cfg(test)]
mod tests;
// Re-export commonly used types for convenience
pub use config_loader::ConfigLoader;
pub use errors::{ConfigFormat, CreateSubcommandError};
pub use handler::handle_create_command;