Skip to content

Add shared list formatting infrastructure for CLI commands - #2

Closed
realrajaryan wants to merge 1 commit into
mainfrom
consolidate-cli-formatting
Closed

Add shared list formatting infrastructure for CLI commands#2
realrajaryan wants to merge 1 commit into
mainfrom
consolidate-cli-formatting

Conversation

@realrajaryan

Copy link
Copy Markdown
Owner

This PR consolidates the duplicated list formatting logic across all CLI list commands into shared infrastructure.

Every list command independently implemented the same if-json/if-quiet/else-table rendering pattern. This extracts that into a ListDisplayable protocol (table contract), printList() (table/quiet rendering), and printJSON() (all JSON encoding across the module).

JSON encoding is deliberately separated from the display protocol -- each command encodes its own raw data model for JSON, while display types only handle table/quiet. Each command keeps its own --format and --quiet flags with domain-specific help text rather than a generic option group.

Also moves TableOutput to ContainerCommands, deletes Codable+JSON.swift, migrates all remaining inline JSONEncoder usage to printJSON, and adds unit tests for the formatting infrastructure.

@github-actions github-actions Bot added the cli label Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant