Skip to content
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(cli): support NO_COLOR #3299

Merged
merged 1 commit into from
Apr 30, 2024
Merged

Conversation

WillLillis
Copy link
Contributor

This adds the option to disable colored text in the test command's output.

It seemed a bit odd to print the (colored) diff key without colors, so when the --no-color option is used the diff key isn't printed, and in print_diff() each diff variant is labeled with "correct"/"expected"/"unexpected" in the line directly above. Another option would be to just leave the diff's formatting the same across the color options.

Closes #2593

@amaanq
Copy link
Member

amaanq commented Apr 29, 2024

@WillLillis do you mind having it check for the NO_COLOR env var instead? I'd rather not add another flag to test

@WillLillis
Copy link
Contributor Author

Sure thing!

@WillLillis WillLillis changed the title feat(cli): Add --no-color option to test command feat(cli): Respect NO_COLOR env var in test command Apr 29, 2024
@amaanq
Copy link
Member

amaanq commented Apr 29, 2024

awesome, thanks

cli/src/main.rs Outdated Show resolved Hide resolved
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>

This allows users to avoid colored output when NO_COLOR is set to 1.
@amaanq
Copy link
Member

amaanq commented Apr 30, 2024

I just moved opt_color to test.rs since it makes more sense to group related functions together - otherwise looks good

@amaanq amaanq changed the title feat(cli): Respect NO_COLOR env var in test command feat(cli): support NO_COLOR Apr 30, 2024
@amaanq amaanq merged commit 946acfd into tree-sitter:master Apr 30, 2024
12 checks passed
@WillLillis WillLillis deleted the colorless_test branch April 30, 2024 00:26
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.

tree-sitter CLI test command always insert ANSI escape character
2 participants