Skip to content

Deduplicate token resolution and use pretty-print in admin commands#65

Merged
telegrapher merged 1 commit into
mainfrom
refactor/dedup-token-resolve-and-pretty-print
Feb 26, 2026
Merged

Deduplicate token resolution and use pretty-print in admin commands#65
telegrapher merged 1 commit into
mainfrom
refactor/dedup-token-resolve-and-pretty-print

Conversation

@telegrapher

Copy link
Copy Markdown
Collaborator

Summary

  • Extract shared resolveToken() helper into ims/config.go. The switch statement mapping Config token fields to ims.TokenType values was duplicated between ims/validate.go and ims/invalidate.go. The new helper covers all 5 token types (AccessToken, RefreshToken, DeviceToken, ServiceToken, AuthorizationCode) and both callers now use it.

  • Use output.PrintPrettyJSON in admin commands. cmd/admin/profile.go and cmd/admin/organizations.go used raw fmt.Println(resp) while all other commands that output JSON used output.PrintPrettyJSON. This makes the output consistent across the CLI.

Extract shared resolveToken() helper into config.go to replace duplicate
switch blocks in validate.go and invalidate.go. Use output.PrintPrettyJSON
in admin profile and organizations commands for consistent JSON output.
@telegrapher
telegrapher merged commit 0f08dae into main Feb 26, 2026
5 checks passed
@telegrapher
telegrapher deleted the refactor/dedup-token-resolve-and-pretty-print branch February 28, 2026 13:56
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