Repository navigation
feat(cli): render routing list and search as tabular views - #2495
Merged
Merged
Conversation
Member
|
Heya @amalsaidov, thanks for the contribution! Could you please fix the lint issues with |
lgecse
force-pushed
the
feat/2478-tabular-cli-output
branch
2 times, most recently
from
November 11, 2026 14:32
368702a to
c53ec22
Compare
The default human output for `dirctl routing list` and `dirctl routing search` printed the collected records with Go's `%v` slice form on a single line, which is hard to read once there is more than one record. Switch the default view to a column-aligned, k8s-style table (CID + labels for list; CID, peer, score and matched labels for search). The json, jsonl and raw formats are delegated to the shared presenter unchanged. The only tabular renderer in the CLI lived privately in the `install` package. Extract it into the shared `presenter` package as `Table` (`NewTable`/`Row`/`String`) plus `OrDash`, migrate `install` to the shared helper, and make `routing` its first additional consumer so the pattern is reusable by other commands. Signed-off-by: amalsaidov <[email protected]> Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Laszlo Gecse <[email protected]>
lgecse
force-pushed
the
feat/2478-tabular-cli-output
branch
from
November 12, 2026 10:00
c53ec22 to
30d42c2
Compare
Signed-off-by: Laszlo Gecse <[email protected]>
lgecse
force-pushed
the
feat/2478-tabular-cli-output
branch
from
November 12, 2026 15:42
8d8a035 to
6322315
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ramizpolic
approved these changes
Nov 12, 2026
Contributor
Author
|
Thanks for merging 🙏 |
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.
What
The default (human) output of
dirctl routing listanddirctl routing searchprinted the collected records using Go's%vslice form on a single line:which is hard to read as soon as there is more than one record (#2478). This renders them as a column-aligned, k8s-style table instead:
searchadditionally shows the providing peer, match score and the labels that matched. Thejson,jsonlandrawformats are delegated to the shared presenter and are byte-for-byte unchanged.How
cli/cmd/install(text/tabwriter-based). To avoid inventing a second one, it is extracted into the sharedcli/presenterpackage asTable(NewTable/Row/String) andOrDash, keeping the exact same geometry and behaviour.installis migrated to the shared helper (pure refactor, output unchanged).routing list/routing searchbuild a typed result slice and render it through the newcli/cmd/routing/output.go: a table forhuman, delegation topresenter.PrintMessagefor the structured formats.This follows the pattern the maintainers already established in the
installcommand rather than introducing a new output abstraction, so it stays focused on the canonicallist/searchcommands and can be extended to other commands incrementally.How tested
Run inside the
cliGo module:go build ./...— passes.go test ./presenter/ ./cmd/routing/ ./cmd/install/— passes.presentertests pin the table alignment andOrDash.cmd/routingtests cover the human table (list and search), the empty case, and that structured formats still delegate (jsonl stays one compact object per line, no table, no%vleak).installtests confirm the refactor left its output unchanged.go vet ./presenter/ ./cmd/routing/ ./cmd/install/andgofmt -l— clean.golangci-lintwas not available in the environment, so it was not run; the code follows the surrounding conventions (e.g. the//nolint:mndon the tabwriter geometry carried over frominstall).Fixes #2478
🤖 Generated with Claude Code