mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 16:27:33 -10:00
devvm ls, devvm images, devvm space and devvm doctor's feature table are colored with the messages' rule for stdout (NO_COLOR or names mode off, FORCE_COLOR or CLICOLOR_FORCE on, TERM=dumb off, else only when stdout is a terminal). Pipes, scripts, --json, doctor --fixes, the run log, DEVVM_MESSAGES=names and tests stay byte-identical. Header rows and totals bold; names, paths, sizes and counts in the default color; base 16 colors only. The roles, by table: - images: current green (32); stale, unfinished, unused, not built yellow (33); DIGEST and KEY dim (2) - ls: Running green, Stopped yellow, any other status (Broken) red (31); GIT on, strict and clone green; NET on green, unenforced red - space: KEPT only copy and leftover yellow; the total row bold - doctor: native green, emulated yellow, unreviewed and none red internal/ui: Table (Header, Row, Total, Break, Flush), Cell and Role (Plain, Good, Attention, Bad, Secondary), from u.Table(), on stdout and colored as it is; cli never reads the environment. Table pads each cell on its plain text before painting it, as text/tabwriter counts the codes' bytes; a plain table is byte for byte tabwriter's with padding 2. New's UIs color only when FORCE_COLOR or CLICOLOR_FORCE says so, which is how cli's tests get a colored one. ui.UI's method max goes to 43 for Table. internal/cli: writeImages, writeList, writeSpace and writeFeatures take a *ui.Table; cell, dim, cellAs and the role functions imageStates, toolStates, vmStatuses, gitModes, netModes, keptRoles, supportCell. Tests: TestTableLikeTabwriter (plain and colored, against tabwriter), TestTableBreak, TestUITable; cli's tables helper renders each table plain and colored and checks they match without the codes, in TestWriteListColored, TestWriteImagesColored, TestWriteImagesTools, TestWriteSpace and TestWriteFeatures, with the expected codes. Docs: using/settings (Colors: tables); contributing (Messages: Colors: tables and roles). Co-Authored-By: Claude Opus 5.5 <[email protected]>