-
Notifications
You must be signed in to change notification settings - Fork 422
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
feat: enable colors on Windows #2896
Conversation
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.
Hi @mattn ! Thank you so much for the contribution, your library is awesome 😍
I just have a question below please 🙇
cmd/copilot/main.go
Outdated
@@ -25,16 +26,23 @@ func init() { | |||
cobra.EnableCommandSorting = false // Maintain the order in which we add commands. | |||
} | |||
|
|||
func main() { | |||
func run() int { | |||
defer colorable.EnableColorsStdout(nil)() |
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 wonder why it wasn't working before 🤔
We're using the following writers when writing to stdout:
copilot-cli/internal/pkg/term/log/log.go
Lines 23 to 24 in 459f729
DiagnosticWriter = color.Error | |
OutputWriter = color.Output |
which uses your library 🤩 as far as I understand:
https://github.com/fatih/color/blob/a05da93ebe62ca9fc6791d3376ec4dad01196448/color.go#L25-L30
Shouldn't that have been working already or am I misunderstanding how colorable.NewColorableStdout()
works?
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.
Ah, copilot-cli already use go-colorable. Okay, I'll fix in another way soon.
Side note, is it possible to update the commit like this: |
I'll squash commits if you want. |
Not needed, thank you for the contribution! |
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.
Thank you for the contribution and your awesome library 😻
Thank you! |
<!-- Provide summary of changes --> On Windows, colors are not enabled. This change enable colors. ![image](https://user-images.githubusercontent.com/10111/136043356-dcf6534b-6d03-48a2-ae10-5e1f20cbd136.png) ![image](https://user-images.githubusercontent.com/10111/136043405-0f86fa79-bac8-4bb5-b968-26cf8e2bbcc0.png) <!-- Issue number, if available. E.g. "Fixes aws#31", "Addresses aws#42, 77" --> By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
On Windows, colors are not enabled. This change enable colors.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.