-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
crates/redisctl/src/cli.rs has grown to 3,032 lines, making it difficult to navigate and maintain.
wc -l crates/redisctl/src/cli.rs
3032 crates/redisctl/src/cli.rsCurrent Structure
The file contains:
- Top-level CLI struct and enums
- Cloud command enums (Account, Subscription, Database, User, ACL, etc.)
- Enterprise command enums (Cluster, Database, Node, etc.)
- Connectivity command enums (VPC, PSC, TGW)
- Fixed plan command enums
- Workflow command enums
- All command argument definitions
Proposed Refactoring
Option 1: Split by Deployment Type (Recommended)
crates/redisctl/src/cli/
├── mod.rs # Top-level CLI struct, Commands enum
├── cloud.rs # All CloudCommands and sub-enums
├── enterprise.rs # All EnterpriseCommands and sub-enums
├── profile.rs # Profile command enums
├── api.rs # Raw API command enums
└── shared.rs # Shared types (OutputFormat, etc.)
Option 2: Granular Split by Resource
crates/redisctl/src/cli/
├── mod.rs
├── cloud/
│ ├── mod.rs
│ ├── account.rs
│ ├── subscription.rs
│ ├── database.rs
│ ├── connectivity.rs
│ └── ...
└── enterprise/
├── mod.rs
├── cluster.rs
├── database.rs
└── ...
Benefits
- Easier Navigation: Find command definitions more quickly
- Better Organization: Group related commands together
- Reduced Merge Conflicts: Changes isolated to specific modules
- Clearer Ownership: Each module has a clear purpose
- Easier to Review: Smaller files in PRs
Considerations
- This is a pure refactoring - no functionality changes
- All imports would need to be updated
- Could be done incrementally (e.g., start with splitting out Cloud commands)
- Pattern to follow: Similar to how
commands/is already organized
Recommendation
Start with Option 1 (split by deployment type) as it's simpler and mirrors the existing command structure. Can further refine later if needed.
Impact
- Low risk: Pure code organization, no logic changes
- Medium effort: ~1-2 hours to split and verify all imports work
- High value: Much easier to maintain going forward
Note: This is a "good housekeeping" issue - not urgent, but will make future development easier.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request