refactor(cloud): clean table output and modular structure#98
Closed
joshrotenberg wants to merge 10 commits intomainfrom
Closed
refactor(cloud): clean table output and modular structure#98joshrotenberg wants to merge 10 commits intomainfrom
joshrotenberg wants to merge 10 commits intomainfrom
Conversation
joshrotenberg
added a commit
that referenced
this pull request
Sep 4, 2025
- Remove unmaintained atty dependency (RUSTSEC-2024-0375, RUSTSEC-2021-0145) - Use std::io::IsTerminal (stable since Rust 1.70.0) instead - Fixes CI security vulnerability check on PR #98
12 tasks
- Add first Layer 2 command with smart table formatting
- Support JMESPath queries that output human-friendly tables
- Color-coded status indicators (green/yellow/red)
- Relative date formatting ("2 hours ago" for recent items)
- Smart field extraction from nested JSON structures
- Support for --json and --yaml output formats
- Human-readable memory sizes (GB/MB)
- Region display as provider/region format
Example usage:
redisctl cloud subscription list # Table output
redisctl cloud subscription list --json # JSON output
redisctl cloud subscription list -q '[?status==\'active\']' # Filtered table
This establishes the pattern for all future human-friendly commands.
- Handle wrapped API response with users array - Extract actual field names (signUp, options.mfaEnabled) - Color-coded role display (OWNER in blue, Admin in yellow) - MFA status with green/red checkmarks - Support for GitHub/SSO user types - Dimmed "Never" for users who haven't logged in Tested with actual Cloud API and working perfectly!
- Replace comfy-table with tabled using blank style (GitHub CLI-like) - Add smart truncation for long fields in table views - Implement vertical detail views for get commands (subscription, database, user, account) - Add automatic pager support for long output - Refactor monolithic cloud.rs (1576 lines) into modular structure: - account.rs: Account commands - subscription.rs: Subscription commands (list, get) - database.rs: Database commands (list, get) - user.rs: User commands (list, get) - utils.rs: Shared utilities and helpers - Support both fixed and flexible subscriptions transparently - Improve output formatting with relative dates and color coding - Maintain full backward compatibility with existing commands
- Remove unmaintained atty dependency (RUSTSEC-2024-0375, RUSTSEC-2021-0145) - Use std::io::IsTerminal (stable since Rust 1.70.0) instead - Fixes CI security vulnerability check on PR #98
- Migrate deprecated 'commit' stage to 'pre-commit' - Migrate deprecated 'push' stage to 'pre-push' - Run pre-commit migrate-config to update configuration
- Update various dependencies including clap, config, and log - All updates are semver-compatible patch/minor versions - No breaking changes
- Replace let-chains (requires Rust 1.64+) with nested if-let statements - Replace is_some_and() (requires Rust 1.70+) with map().unwrap_or(false) - Add clippy allow attributes for resulting collapsible-if warnings - Ensures CI passes with project's minimum supported Rust version
- Move pager dependency to target-specific dependencies for Unix only - Add conditional compilation for pager imports and usage - Fixes CI failures on Windows where pager crate uses Unix-specific APIs
6637129 to
8f8c61a
Compare
- Move std::io::IsTerminal import behind cfg(unix) attribute - Fixes unused import warning on Windows builds - Complements the Unix-only pager dependency
- Map anyhow::Error to RedisCtlError::OutputError in all Cloud commands - Add RedisCtlError import to cloud command modules - Fixes compilation errors on all platforms
joshrotenberg
added a commit
that referenced
this pull request
Sep 4, 2025
- Add clean GitHub CLI-style table output using tabled library - Refactor monolithic cloud.rs into focused modules: - account.rs for account commands - subscription.rs for subscription management - database.rs for database operations - user.rs for user management - utils.rs for shared utilities - Add vertical detail views for get commands - Implement automatic paging for long output (Unix only) - Add smart truncation for table fields - Support JSON/YAML output formats with -o flag - Fix Windows compatibility (Unix-only pager, IsTerminal) - Fix error handling for anyhow::Error conversions - Add comprehensive test coverage Replaces PR #98 with clean rebase on main
Collaborator
Author
|
Closing in favor of #109 which has a clean rebase on main to avoid CI dependency issues. All changes have been preserved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This PR refactors the cloud commands to provide cleaner, more readable output and better code organization.
Key Changes
🎨 Clean Table Output
📐 Vertical Detail Views
Added
getcommands with vertical layout for detailed views:cloud subscription get <id>- Full subscription detailscloud database get <id>- Complete database infocloud user get <id>- User details with security settingscloud account get- Account information🏗️ Modular Structure
Refactored monolithic cloud.rs (1576 lines) into focused modules:
account.rs- Account commandssubscription.rs- Subscription commandsdatabase.rs- Database commandsuser.rs- User commandsutils.rs- Shared utilities and helpersBefore/After
Before (Unicode borders, wrapping issues):
After (Clean, GitHub-style):
Features
-o jsonor-o yaml)Test Plan