Repository navigation
Phase 7: color by status and fit output to the terminal - #23
Open
loganthomas wants to merge 4 commits into
Open
loganthomas wants to merge 4 commits into
loganthomas wants to merge 4 commits into
Conversation
"listed above" was wrong when the fixes are in the JSON payload.
Status-only color (doctor ok/warn/fail, tree and slot states, the error prefix) behind ui.color, which until now was parsed but unused. NO_COLOR is checked to the spec's letter, since colorprofile ignores it on pipes. Narrow terminals middle-truncate path columns (only when that makes the table fit) and wrap doctor text with a hanging indent. render.Align measures display cells, so colored cells still align. Non-terminal output is byte-identical to before. Also drops the R5/R7 plan IDs from doctor's user-facing text.
A dim header row; clean/dirty, HEAD, and age columns; a TOOLS column (fresh/stale refresh gate) when refresh_if_changed is configured; the path last with home shown as ~. Dirty state is one parallel git status per tree, commit times one git show for all heads. LEASE leads the slot table. JSON gains dirty, committed_at, tools (ls) and path, head, dirty, tools (slots), each omitted when false or empty.
In pool mode wt ls now shows every tree and every slot in one table (TREE LEASE BRANCH STATE [TOOLS] HEAD AGE NOTE PATH), so there is one listing command in both modes. ls --json tags slot trees with slot and lease; --porcelain is unchanged. Slot STATE uses the same clean/dirty, locked, prunable spelling as default mode. Path truncation now stops at 24 cells: a slightly long row reads better than a mangled short path.
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.
Human output now uses color to mark status, and adapts to narrow terminals. Anything not going to a terminal stays byte-identical to before.
Color, status only. doctor's
ok/warn/fail/info(green/yellow/red/dim), a dimcause:line and boldfix:label,locked/prunabletree states, pool slot states (freegreen,staleyellow,unprovisioneddim), a stale base inwt status, and a redwt:error prefix. Basic 16 ANSI colors, so the terminal theme decides the shades.ui.coloris now honored. It was parsed and validated but unused.autodefers to colorprofile for TTY/TERM/CLICOLOR_FORCE, butNO_COLORis checked directly to the spec: colorprofile ignores it on non-terminals (soCLICOLOR_FORCEwould win) and only counts boolean values. A broken global config reads asautohere, so color is never why a command fails.Narrow terminals. Path columns in
lsandstatusare middle-truncated (/Users/me/sr…-branch-name), but only when that makes the table fit; a table that overflows anyway keeps its full paths rather than losing characters for nothing. Doctor text wraps with a hanging indent.render.Alignnow measures display cells, so colored and plain cells align.Table layout.
lsandstatusget a dim header row and the path as the last column, with home shown as~:STATE is clean/dirty (one
git statusper tree, in parallel) plus git's locked/prunable; AGE is the HEAD commit's age (onegit showfor all heads); TOOLS shows whether the refresh hook is current, and appears only with arefresh_if_changedgate.One listing command.
wt pool lsis folded intowt ls: in pool mode,wt lsshows the trees outside the pool and every slot, provisioned or not, in one table:AGE is claim age there.
wt statusreuses the same slot table;wt poolkeepsresize. JSON gainsdirty,committed_at,tools, and on slot treesslotandlease(ls), andpath,head,dirty,toolsonstatusslots, each omitted when false or empty per the existing contract.--porcelainis unchanged. Error messages that pointed atwt pool lsnow point atwt ls.Tests. Golden files for
ls,status, anddoctorat color-80, plain-80 (also theNO_COLORoutput), and plain-40;useColorcases foralways/never/NO_COLOR/CLICOLOR_FORCE;FitColumnunit tests in a new file. Existing tests: formatter call sites gained their new arguments; thelsheader changed twols_testexpectations (row count, one exact line), four script regexes follow the new column order, and the twelveexec wt pool lslines now runwt ls. Each still asserts the same facts.Also:
wt doctor's exit message said fixes were "listed above", which is wrong under--json(introduced in Phase 7: every error message names its fix #22, unreleased).(R5)/(R7).x/ansiandcolorprofileare now direct imports. Both are lipgloss's own sub-packages and already in the build throughhuh, so no new module is added.The help-text audit is the next PR.