refactor: Extract profile commands from main.rs to dedicated module (Issue #402) #403
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Extracts all profile command handlers from
main.rsinto a dedicatedcommands/profile.rsmodule, following the established pattern ofcommands/api.rsandcommands/files_key.rs.Changes
New Module:
commands/profile.rsCreated new module with 8 focused handler functions:
handle_list- List all profiles with table/JSON formattinghandle_path- Show config file pathhandle_show- Show profile detailshandle_set- Create/update profiles with keyring supporthandle_remove- Remove profiles with confirmationhandle_default_enterprise- Set default enterprise profilehandle_default_cloud- Set default cloud profilehandle_validate- Validate configuration (added in UX improvements: Better error messages and command hints #259)Updated Files
commands/mod.rs- Addedpub mod profile;main.rs- Updated to callcommands::profile::handle_profile_command()Contextimport from main.rsImpact
Before
After
Benefits
Testing
Functionality Verification
All profile commands continue to work:
redisctl profile list- Table and JSON outputredisctl profile path- Show config pathredisctl profile show <name>- Show profile detailsredisctl profile set <name>- Create/update profilesredisctl profile remove <name>- Remove with confirmationredisctl profile default-enterprise <name>redisctl profile default-cloud <name>redisctl profile validate- Configuration validationCode Quality
-D warnings)Related
Closes #402
Part of ongoing code quality improvements to make the codebase more maintainable.