Repository navigation
refactor: print each lodgectl list table with one helper - #60
Merged
Merged
Conversation
bketelsen
approved these changes
Nov 11, 2026
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
cmd/lodgectl/main.gohad 7 functions (showUsage,showApps,showLogins,showNodes,showTokens,showSessions,showModels) that repeat one pattern: decode a JSON list, make 1 row per item, print the table. This PR adds 1 generic helper,showList[T], and each of the 7 functions becomes a call to it with its header and its row function. The names, the signatures, the headers, the cells and their order stay the same, soparsedoes not change.No change in behavior: the same stdout for every list command, the same decode error, and the same
--jsonoutput (which does not use these functions).Left out on purpose:
cmd/lodgectl/login.go(a risk path) and the localcmphelper, whichlogin.goalso uses;showStatus,showDone,showIssuedandshowImported, which do not print a list.Risk tier
Risk tier: 1 — a refactor of the CLI's table printing with no change in behavior; no path in
.github/risk-paths.jsonis touched.Verification
b5f3d08) addscmd/lodgectl/show_test.go, characterization tests that pin the exact stdout of all 7 tables (2 rows each,-cells, empty lists) and their decode error. On the base code:go test -count=1 ./cmd/lodgectl/→ok(0.072s).18aa34f) is the refactor. The existing tests and the new ones are unchanged.make checkgreen (host): on the base74a31e4, exit 0; on the head18aa34f, exit 0.Cross-review
openai/gpt-6.1-sol; coderdeepseek/deepseek-flash.74a31e4856b5e44da4567c53307cb83cf1354bf1, head18aa34f899bbf829af18941c6064eabb1c61ef3b; 1 pass, both changed files.