Skip to content

Color the table output - #71

Merged
weppos merged 2 commits into
mainfrom
output-color
Aug 24, 2026
Merged

Color the table output#71
weppos merged 2 commits into
mainfrom
output-color

Conversation

@weppos

@weppos weppos commented Aug 24, 2026

Copy link
Copy Markdown
Member

Table output prints the header row in bold and the pagination hints of a multi-page list in faint, and --no-color or NO_COLOR turns the color off. The update check also skips on BUILD_NUMBER and RUN_ID, and it now requires both the standard output stream and the standard error stream to be a terminal.

🔍 QA

Scenario: a multi-page list in a terminal

  • Run a list command that spans more than one page, for example dnsimple records list example.com --per-page 2.
  • Confirm the Showing 2 of 6 records (page 1 of 3). summary above the table and the Pass --all ... advice below it are both faint.
  • Confirm the header row is bold and the table rows are at normal intensity.
  • Confirm the header labels still line up with the columns underneath them. A misalignment here means the escape sequences reached tabwriter.

Scenario: color is turned off

  • Run the same command with --no-color, and again with NO_COLOR=1.
  • Confirm the summary, the header, and the advice all appear with no color, and that the layout does not change.
  • Redirect the standard output stream to a file and confirm the file holds no escape sequence.

Scenario: the update check skip

  • Run any command with BUILD_NUMBER=1, and again with RUN_ID=1. Confirm no release notice appears.
  • Redirect the standard output stream to a file while leaving the standard error stream on the terminal. Confirm no release notice appears.

📋 Deployment Pre/Post tasks

N/A

:shipit: Deployment Verification

  • Run make and trigger a domain list to verify the changes

weppos added 2 commits August 24, 2026 12:09
The --no-color flag was plumbed through to output.Printer but nothing
read it. Table output now prints the header row in bold, and the new
output.ColorEnabled helper decides colour from the flag, the NO_COLOR
environment variable, and whether the target writer is a terminal. The
update notice uses the same helper.

tabwriter sizes a column by the byte count of its cells, so the table is
laid out first and the escape sequences wrap the finished header line.
Wrapping each header cell instead would shift every column.

The update check also skips on BUILD_NUMBER and RUN_ID, and now requires
both the standard output stream and the standard error stream to be a
terminal.

Mark fatih/color as a direct dependency. It was recorded as indirect
because the module was added before the first import.
The hints are advice about the table rather than part of it, so they
render faint and let the table itself stay at full intensity. They go to
the error stream, so the colour decision reads that writer.
@weppos weppos self-assigned this Aug 24, 2026
@weppos weppos added the enhancement New feature, enhancement or code changes, not related to defects label Aug 24, 2026
@weppos
weppos merged commit 06c455a into main Aug 24, 2026
8 checks passed
@weppos
weppos deleted the output-color branch August 24, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, enhancement or code changes, not related to defects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant