Skip to content

Colour usage help on the command's terms, not picocli's guess - #45

Merged
david-Darkcollective merged 1 commit into
developfrom
fix/help-color-follows-host
Oct 12, 2026
Merged

david-Darkcollective merged 1 commit into
developfrom
fix/help-color-follows-host

Conversation

@david-Darkcollective

Copy link
Copy Markdown
Member

The release dry run (run 38277132878) failed on Windows: four tests found Usage: \e[1mrelix… where they expected Usage: relix…, and fail-fast cancelled the other platforms.

Cause. Usage help used picocli's Ansi.AUTO. It reads the real process rather than the Host, and on Windows it takes an MSYS or Cygwin TERM for a terminal. The release job runs its build under shell: bash (Git Bash), so help was coloured into a captured stream. CI runs Windows under PowerShell, which sets no TERM, so it passed. A user would see the same thing: relix help | less in Git Bash got escape codes.

Fix. Main sets the colour scheme from the Host, on the terms --color=auto colours rows: on when standard output is a terminal and $NO_COLOR is unset, off otherwise. The result no longer depends on the machine or the shell.

Tests. The three tests that compare help text now pipe standard output, as a capture is. (The harness defaults to a terminal, so they had only passed because picocli saw no console in the test JVM.) A new test checks help is coloured on a terminal, and not in a pipe or with NO_COLOR.

./gradlew clean build passes on macOS. The release dry run should be dispatched again once this merges.

Usage help used picocli's Ansi.AUTO, which reads the real process rather
than the Host, and on Windows takes an MSYS or Cygwin TERM for a
terminal. So in Git Bash help written to a pipe came out coloured, and
the release workflow's Windows job, which runs under bash, failed four
tests whose captured help began "Usage: \e[1mrelix" (CI runs Windows
under PowerShell, which sets no TERM, and passed).

Help is now coloured on the terms --color=auto colours rows: when the
Host says standard output is a terminal and $NO_COLOR is not set, and
never otherwise. The tests that read help text pipe standard output, as
a capture is, and a new test checks the three cases.
@david-Darkcollective
david-Darkcollective merged commit 7e3840c into develop Oct 12, 2026
3 checks passed
@david-Darkcollective
david-Darkcollective deleted the fix/help-color-follows-host branch October 12, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant