tpagectl: output and 404 helpers duplicated across site and deployment #565

Closed
opened 2026-08-06 03:46:42 +00:00 by the.auditor · 1 comment
Owner

internal/tpagectl/deployment/list.go re-implements helpers already present in internal/tpagectl/site:

  • printTable / writeJSON / writeYAML + the --format dispatch switch are duplicated between the site and deployment packages
  • the 404-to-friendly-message mapping is now a fourth inline copy (extends #561)

Suggested fix: extract shared output rendering (table/json/yaml) and the friendlyNotFound helper into a shared package (e.g. internal/tpagectl/output) used by both command groups.

Ref: PR #564

`internal/tpagectl/deployment/list.go` re-implements helpers already present in `internal/tpagectl/site`: - `printTable` / `writeJSON` / `writeYAML` + the `--format` dispatch switch are duplicated between the `site` and `deployment` packages - the 404-to-friendly-message mapping is now a fourth inline copy (extends #561) Suggested fix: extract shared output rendering (table/json/yaml) and the `friendlyNotFound` helper into a shared package (e.g. `internal/tpagectl/output`) used by both command groups. Ref: PR #564
Owner

Fixed in #635: output.RenderFormat centralizes the --format dispatch (json/yaml/table + validation error) shared by site list/site get and deployment list/deployment get; the 404 mapping is centralized in clierr.NotFoundf. Type-specific row building stays local in each package's printTable.

Fixed in #635: `output.RenderFormat` centralizes the `--format` dispatch (json/yaml/table + validation error) shared by `site list`/`site get` and `deployment list`/`deployment get`; the 404 mapping is centralized in `clierr.NotFoundf`. Type-specific row building stays local in each package's `printTable`.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/thwap-pagesd#565
No description provided.