Skip to content

Refactor pretty-print JSON into cmd/pretty package#68

Merged
telegrapher merged 1 commit into
fix/capture-serve-errorfrom
refactor/pretty-json-package
Feb 27, 2026
Merged

Refactor pretty-print JSON into cmd/pretty package#68
telegrapher merged 1 commit into
fix/capture-serve-errorfrom
refactor/pretty-json-package

Conversation

@telegrapher

Copy link
Copy Markdown
Collaborator

Summary

  • New cmd/pretty package with pretty.JSON(string) string. Returns prettified JSON, or the original string if not valid JSON. Callers handle their own printing.

  • Remove output package. The old PrintPrettyJSON both prettified and printed. The new approach separates concerns: pretty.JSON() formats, fmt.Println() prints.

  • Simplify ims/decode.go. DecodeToken() no longer prettifies — it returns raw decoded JSON strings. cmd/decode.go applies pretty.JSON() before printing. Removed dead Signature field from DecodedToken.

  • All 10 callers updated to use fmt.Println(pretty.JSON(...)).

Note: This PR is stacked on #67 (fix/capture-serve-error). Once #67 merges, GitHub will automatically retarget this PR to main.

Replace the output package with cmd/pretty. The new pretty.JSON()
function returns a prettified string instead of printing directly,
letting callers handle their own output.

Move prettifying out of ims/decode.go — DecodeToken now returns raw
JSON strings, and cmd/decode.go applies pretty.JSON before printing.

Remove unused DecodedToken.Signature field.
@telegrapher
telegrapher merged commit ff3d904 into fix/capture-serve-error Feb 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants