feat: add JSON output to purge command (12.12)#395
Merged
Conversation
- Add PurgeDetailsData DTO with from_environment_name constructor - Add JsonView and TextView for purge command (Strategy Pattern) - Add output_format param to PurgeCommandController::execute() - Dispatch to TextView or JsonView in complete_workflow() - Update router to pass context.output_format() to purge controller - Add unit tests for DTO, JsonView, and TextView
a51eb53 to
fa8c998
Compare
Member
Author
|
ACK fa8c998 |
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
Implements roadmap task 12.12 — adds
--output-format jsonsupport to thepurgecommand.Closes #394.
Changes
New files
src/presentation/cli/views/commands/purge/mod.rs— module with re-exportssrc/presentation/cli/views/commands/purge/view_data/purge_details.rs—PurgeDetailsData { environment_name, purged }withfrom_environment_name()constructorsrc/presentation/cli/views/commands/purge/views/json_view.rs—JsonView::render()→ pretty-printed JSONsrc/presentation/cli/views/commands/purge/views/text_view.rs—TextView::render()→"Environment '…' purged successfully"Modified files
src/presentation/cli/views/commands/mod.rs— addedpub mod purge;src/presentation/cli/controllers/purge/handler.rs— addedoutput_format: OutputFormattoexecute(), updatedcomplete_workflow()to dispatch via Strategy Patternsrc/presentation/cli/dispatch/router.rs—Commands::Purgearm readscontext.output_format()and passes it to the controllerdocs/user-guide/commands/purge.md— added JSON output section with examplesdocs/issues/394-add-json-output-to-purge-command.md— marked all goals and checklist items as completeproject-words.txt— addedcheckmarkto avoid cspell false positiveJSON Output Format
{ "environment_name": "my-env", "purged": true }purgedis alwaystrueon the success path — failures exit with a non-zero code and produce no JSON output.Testing
cargo test --lib)PurgeDetailsData,JsonView, andTextViewcargo run --bin linter all)cargo machete— no unused dependenciesNotes for Manual Verification (Phase 5)
Before merging, a user with an existing environment can verify both outputs:
Expected JSON:
{ "environment_name": "<env>", "purged": true }