Repository navigation
Colour usage help on the command's terms, not picocli's guess - #45
Merged
Merged
Conversation
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.
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.
The release dry run (run 38277132878) failed on Windows: four tests found
Usage: \e[1mrelix…where they expectedUsage: relix…, and fail-fast cancelled the other platforms.Cause. Usage help used picocli's
Ansi.AUTO. It reads the real process rather than theHost, and on Windows it takes an MSYS or CygwinTERMfor a terminal. The release job runs its build undershell: bash(Git Bash), so help was coloured into a captured stream. CI runs Windows under PowerShell, which sets noTERM, so it passed. A user would see the same thing:relix help | lessin Git Bash got escape codes.Fix.
Mainsets the colour scheme from theHost, on the terms--color=autocolours rows: on when standard output is a terminal and$NO_COLORis 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 buildpasses on macOS. The release dry run should be dispatched again once this merges.