Migrate hardcoded ANSI color codes to fatih/color#158
Merged
Conversation
Replace custom Color type and raw ANSI escape sequences with fatih/color for cross-platform terminal support. This enables automatic NO_COLOR env var support, TERM=dumb detection, and Windows console compatibility via go-colorable. Add display.plain golden file tests to verify color-disabled output. Closes #28 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The status command is typically invoked via the scmpuff_status() shell wrapper which captures stdout in a subshell, so fatih/color's default TTY detection (against stdout) always sees a pipe. Instead, check stderr (which remains connected to the user's terminal) and honor the NO_COLOR convention (https://no-color.org/). Add integration test verifying both NO_COLOR and non-TTY detection through the full shell wrapper across bash/zsh/fish. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
|
@christoph-heiss want to take a look at these new ANSI files and make sure they still work on your terminal theme? |
Owner
Author
|
Have been running locally for 2 weeks and working fine for me, so going to mark visual inspection manually verified. |
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
Colorstring type and raw ANSI escape sequences withfatih/colorfor cross-platform terminal supportscmpuff_statusshell wrapper) and honor theNO_COLORconventiongo-colorabledisplay.plaingolden file tests and integration tests for color detectionCloses #28
Test plan
go test ./...)color.NoColor = truepathNO_COLOR=1disables color throughscmpuff_statusshell wrapper (bash/zsh/fish)scmpuff_statusshell wrapper (bash/zsh/fish)scmpuff statusmatching prior appearance