-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#285 add color output for mage list #301
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9495507
#285 add color output for mage list
mirogta 0a042a3
added color configuration via MAGEFILE_ENABLE_COLOR and MAGEFILE_TARG…
mirogta 9a98a25
fixed template
mirogta 90314f9
typo
mirogta d1da6c9
more typos
mirogta 50d2587
fix test
mirogta a894948
simplify color terminal detection
mirogta d4fdf58
fix: color output test in CI
mirogta 71bfbb0
fix: test in CI
mirogta 7afad3c
Update mage/main_test.go
natefinch a1f2a7c
Update mg/runtime.go
natefinch 7254217
Update mg/runtime.go
natefinch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kinda skeeves me out. Are we sure there are no existing terminals that include the substring xterm that don't support color? (I ask because I have no clue)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the best I could find was that there's "xterm-mono". I've added a condition to disable terminal support if this is detected.
See rust-lang/cargo#7646
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can say from experience that this topic could be a separate study course 🙉
Here's a list of possible terminal identifiers from my color theme project for GNU dircolors (the tool that provides the color database for the GNU
ls
command by populating theLS_COLORS
environment variable).The list contains a lot more IDs and I'm sure it still misses some, e.g. new terminals like Alacritty bring their own new identifiers and terminfo definitions.
Anyway, maybe it's easier to only check for terminal IDs that are definitely known to not support colors and let all other IDs pass. This way the list could be extended from time to time when users report terminal IDs that are not checked yet. Since this is a opt-in feature it should not break anyone's output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! @natefinch any objections? The code would get significantly simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed this was a question for me. Yes, let's do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool - done, see the update.
I've used a map rather than a list for performance, so that I don't need to iterate over it and just use the terminal name as a key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"It works on my machine" including all tests, but having some trouble with tests in Travis CI. Trying to find out what is the TERM set to...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good now. Ready for a merge & release?