Color the table output - #71
Merged
Merged
Conversation
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.
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.
Table output prints the header row in bold and the pagination hints of a multi-page list in faint, and
--no-colororNO_COLORturns the color off. The update check also skips onBUILD_NUMBERandRUN_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
dnsimple records list example.com --per-page 2.Showing 2 of 6 records (page 1 of 3).summary above the table and thePass --all ...advice below it are both faint.tabwriter.Scenario: color is turned off
--no-color, and again withNO_COLOR=1.Scenario: the update check skip
BUILD_NUMBER=1, and again withRUN_ID=1. Confirm no release notice appears.📋 Deployment Pre/Post tasks
N/A
makeand trigger adomain listto verify the changes