-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmod.rs
More file actions
65 lines (63 loc) · 2.81 KB
/
mod.rs
File metadata and controls
65 lines (63 loc) · 2.81 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
58
59
60
61
62
63
64
65
//! Input Layer - Presentation Layer Component
//!
//! The Input Layer is responsible for parsing and validating user input from various sources,
//! primarily the command-line interface. This is the first layer in the presentation layer's
//! four-layer architecture: Input → Dispatch → Controllers → Views.
//!
//! ## Purpose
//!
//! The Input Layer establishes a clear separation between:
//! - **Raw user input** (command-line arguments, configuration files)
//! - **Validated input data** ready for command dispatch
//! - **Command execution logic** (handled by other presentation layers)
//!
//! This separation provides several benefits:
//! - **Single Responsibility**: Input parsing is isolated from command execution
//! - **Testability**: Input validation can be tested independently
//! - **Flexibility**: Easy to add new input sources (web UI, API, config files)
//! - **Error Handling**: Input validation errors are handled at the appropriate layer
//!
//! ## Module Structure
//!
//! ```text
//! input/
//! ├── mod.rs # This file - layer exports and documentation
//! └── cli/ # Command-line interface parsing (moved from presentation/cli)
//! ├── mod.rs # Main CLI structure and parsing logic
//! ├── args.rs # Global CLI arguments (logging config)
//! └── commands.rs # Subcommand definitions
//! ```
//!
//! ## Design Principles
//!
//! - **Parse, Don't Execute**: This layer only parses and validates input
//! - **Early Validation**: Catch input errors as soon as possible
//! - **Clean Data Structures**: Provide well-typed data to subsequent layers
//! - **User-Friendly Errors**: Generate helpful error messages for invalid input
//!
//! ## Integration with Presentation Layer
//!
//! The Input Layer integrates with the broader presentation layer architecture:
//!
//! 1. **Input Layer** (this module) - Parses user input
//! 2. **Dispatch Layer** (`commands/mod.rs`) - Routes commands to handlers
//! 3. **Controller Layer** (`commands/*/handler.rs`) - Executes command logic
//! 4. **View Layer** (`user_output/`, `progress.rs`) - Presents results to users
//!
//! ## Future Enhancements
//!
//! As part of the presentation layer reorganization (Issue #154), this Input Layer
//! will serve as the foundation for:
//! - Configuration file input parsing
//! - Environment variable input handling
//! - Potential future input sources (API, web interface)
//!
//! ## Related Documentation
//!
//! - [Presentation Layer Reorganization Plan](../../docs/refactors/plans/presentation-layer-reorganization.md)
//! - [DDD Layer Placement Guide](../../docs/contributing/ddd-layer-placement.md)
//! - [Module Organization](../../docs/contributing/module-organization.md)
// CLI input parsing module
pub mod cli;
// Re-export CLI types for convenience
pub use cli::{Cli, Commands, GlobalArgs};