Add table output format for nwp-cli reservations get#76
Merged
Conversation
- Document new table output as default format - Document --json flag for JSON output - Add examples showing both table and JSON formats - Show global reservation status indicator in example - Update Example 8 to demonstrate both get formats Co-authored-by: eman <19387+eman@users.noreply.github.com>
Co-authored-by: eman <19387+eman@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add table output as default for nwp-cli reservations get
Add table output format for Feb 16, 2026
nwp-cli reservations get
Owner
|
@copilot this PR has CI failures that need to be fixed. |
- handlers.py: Extract dict values to typed variables before passing to formatter - rich_output.py: Avoid reusing 'enabled' parameter name for string value Fixes CI type checking failures (2 errors reduced to 0) Co-authored-by: eman <19387+eman@users.noreply.github.com>
Contributor
Author
Fixed the CI type checking failures in commit c8065d5. Issues resolved:
Changes:
Pyright now reports 0 errors (down from 2). |
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.
Reservations Table Feature - Complete Implementation
Completed Implementation ✓
--jsonflag tonwp-cli reservations getcommandFiles Modified
src/nwp500/cli/__main__.py- Added--jsonoption to reservations_get commandsrc/nwp500/cli/handlers.py- Updated handler to support JSON/table output modes, pass global status, and fix type checkingsrc/nwp500/cli/rich_output.py- Added print_reservations_table() and helper methods, fixed variable naming for type safetydocs/python_api/cli.rst- Updated documentation to reflect table format, --json flag, and examplesCHANGELOG.rst- Added entry for CLI reservations table output featureCI Status
Original prompt
Chronological Review:
The conversation progressed through two main phases:
Phase 1 (Initial Request): User requested table output as default for
nwp-cli reservations getwith optional--jsonflag. Agent explored the codebase structure, identified the CLI command architecture, examined the existing handlers and output formatters, then implemented table formatting capabilities using the Rich library.Phase 2 (Enhancement Request): After initial implementation was complete and validated, user requested adding a status indicator showing whether reservations are in use/enabled globally (distinct from individual reservation enabled status). Agent modified existing implementation to capture and display this status information before rendering the table.
Intent Mapping:
Technical Inventory:
Code Archaeology:
Files created/modified:
src/nwp500/cli/__main__.py- reservations_get commandsrc/nwp500/cli/handlers.py- handle_get_reservations_request functionsrc/nwp500/cli/rich_output.py- OutputFormatter class with table printing methods/home/emmanuel/.copilot/session-state/5837b710-acc6-4f11-8a70-02104be7c214/plan.md- tracking documentProgress Assessment:
Completed:
Remaining: None - feature fully implemented and validated
Context Validation:
All critical information for understanding the completed feature is captured:
Recent Commands Analysis:
Last agent commands executed (Phase 2):
view- Examined handlers.py to understand data structure with reservationEnabled fieldedit- Updated handlers.py line 305-309: Changed fromprint_json(output)to conditional: if output_json use JSON, else call_formatter.print_reservations_table(output["reservations"], output["reservationEnabled"])edit- Updated rich_output.py line 314-325: Modified print_reservations_table() signature to acceptenabled: bool = Falseparameteredit- Updated rich_output.py line 424-453: Modified _print_reservations_plain() to display status line first:print(f"Reservations: {status_str}")where status_str is "ENABLED" or "DISABLED"edit- Updated rich_output.py line 598-641: Modified _print_reservations_rich() to create status panel before table with color coding (green for enabled, red for disabled)bash- Ran linting: "Ruff linting check - PASSED", "Ruff format check - PASSED", "Pyright type checking - PASSED"bash- Ran type checking: "Success: no issues found in 39 source files"bash- Ran tests: "426 passed in 2.54s"bash- Showed git diff for handlers.py displaying the changesbash- Showed git diff for rich_output.py (150 lines of output shown) displaying the changesupdate_todo- Updated plan.md with completed statusTool Results (Recent Operations):
From linting check: All three check types passed (Ruff linting, Ruff format, Pyright type checking). Pre-existing warnings noted but no new errors.
From mypy: "Success: no issues found in 39 source files" - clean type checking
From pytest: "426 passed in 2.54s" - all tests passing, no failures
From git diff handlers.py:
output_json: bool = Falseparameter to handle_get_reservations_requestprint_json(output)to conditional logic that checks output_json flag and either prints JSON or calls formatter with reservation list and enabled statusFrom git diff rich_output.py (key sections):
Created from Copilot CLI via the copilot delegate command.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.