feat: rich CLI output with tables and Description dedent - #38
Merged
Conversation
Use ">" (1 byte) instead of "…" (3 bytes) when the column width is <4, so the rendered byte count always matches the column slot and table alignment is preserved. Also fix the file-level doc comment: the shrink loop rounds down, so the table is slightly narrower than terminal_width, not wider.
3 tasks
N283T
added a commit
that referenced
this pull request
Apr 16, 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
relations,search, and thecategory NAMEItems list as Unicode-boxed tables when stdout is a tty; tab-separated when piped--no-tableflag forces plain TSV output regardless of ttyDescriptiontext strips the common leading whitespace mmCIF.dicfiles carry into multi-line strings; paragraphs now read as intendedrelationsandsearchis now tab-separated columns instead of prose. Machine consumers should use--json.Approach
src/term.zig:isTtywrappingstd.posix.isatty,widthvia$COLUMNS(default 80). No libc, no ioctl.src/table.zig: self-hostedrender(tsv/boxed) +renderGrid(single-column multi-line grid). 52 inline tests.src/output.zigfromformat: Formattoopts: Optionscarrying{ format, text_style, terminal_width }. All print functions updated;main.zigcall sites follow.printRelationsandprintSearchResultstake the caller'sgpaand use short-lived arenas for row storage.Test plan
zig build test) — 52 pass (term + table primitives + description dedent + existing)uv run --script tests/test_smoke.py) — 25 pass (7 new: pipe-TSV shape,--no-tableidempotence,--jsonignores--no-table, items preserve 2-space legacy indent,--helpmentions flag, pty-based boxed verification with POSIX skipif)relations atom_sitepiped → TSV; on a real tty → Unicode boxtest_json_output_unchanged_by_table_flag)Out of scope (follow-ups)
NO_COLORhandlingitemcommand'sAllowed values:section (not converted to grid)