Skip to main content

torrust_tracker_deployer_lib/presentation/cli/input/
mod.rs

1//! Input Layer - Presentation Layer Component
2//!
3//! The Input Layer is responsible for parsing and validating user input from various sources,
4//! primarily the command-line interface. This is the first layer in the presentation layer's
5//! four-layer architecture: Input → Dispatch → Controllers → Views.
6//!
7//! ## Purpose
8//!
9//! The Input Layer establishes a clear separation between:
10//! - **Raw user input** (command-line arguments, configuration files)
11//! - **Validated input data** ready for command dispatch
12//! - **Command execution logic** (handled by other presentation layers)
13//!
14//! This separation provides several benefits:
15//! - **Single Responsibility**: Input parsing is isolated from command execution
16//! - **Testability**: Input validation can be tested independently
17//! - **Flexibility**: Easy to add new input sources (web UI, API, config files)
18//! - **Error Handling**: Input validation errors are handled at the appropriate layer
19//!
20//! ## Module Structure
21//!
22//! ```text
23//! input/
24//! ├── mod.rs     # This file - layer exports and documentation
25//! └── cli/       # Command-line interface parsing (moved from presentation/cli)
26//!     ├── mod.rs     # Main CLI structure and parsing logic
27//!     ├── args.rs    # Global CLI arguments (logging config)
28//!     └── commands.rs # Subcommand definitions
29//! ```
30//!
31//! ## Design Principles
32//!
33//! - **Parse, Don't Execute**: This layer only parses and validates input
34//! - **Early Validation**: Catch input errors as soon as possible
35//! - **Clean Data Structures**: Provide well-typed data to subsequent layers
36//! - **User-Friendly Errors**: Generate helpful error messages for invalid input
37//!
38//! ## Integration with Presentation Layer
39//!
40//! The Input Layer integrates with the broader presentation layer architecture:
41//!
42//! 1. **Input Layer** (this module) - Parses user input
43//! 2. **Dispatch Layer** (`commands/mod.rs`) - Routes commands to handlers
44//! 3. **Controller Layer** (`commands/*/handler.rs`) - Executes command logic
45//! 4. **View Layer** (`user_output/`, `progress.rs`) - Presents results to users
46//!
47//! ## Future Enhancements
48//!
49//! As part of the presentation layer reorganization (Issue #154), this Input Layer
50//! will serve as the foundation for:
51//! - Configuration file input parsing
52//! - Environment variable input handling
53//! - Potential future input sources (API, web interface)
54//!
55//! ## Related Documentation
56//!
57//! - [Presentation Layer Reorganization Plan](../../docs/refactors/plans/presentation-layer-reorganization.md)
58//! - [DDD Layer Placement Guide](../../docs/contributing/ddd-layer-placement.md)
59//! - [Module Organization](../../docs/contributing/module-organization.md)
60
61// CLI input parsing module
62pub mod cli;
63
64// Re-export CLI types for convenience
65pub use cli::{Cli, Commands, GlobalArgs};