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

[Feature] Expose --color to as variable/function #1665

Open
Maetveis opened this issue Sep 6, 2023 · 2 comments
Open

[Feature] Expose --color to as variable/function #1665

Maetveis opened this issue Sep 6, 2023 · 2 comments

Comments

@Maetveis
Copy link

Maetveis commented Sep 6, 2023

It would be nice to allow recipes to query if just output is colored or not, recipes could use color whenever just output itself is colored.

Example (syntax for demonstration only):

color := if colored_output() == "true" {"always"} else {"never"}

compile:
   gcc --color="{{ color }}" foo.c

A justfile like this could be nice in CI to color subcommands (call via just --color=always), and still behave correctly when piped to a file.

As far as I see just can independently color its standard output and error streams, so it might make sense to provide queries for both.

@avi-cenna
Copy link
Contributor

Is this related to #1186? The main issue for me right now is that when just echos the command that it's running, it prints it in white, and this gets lost amongst the other output. It is a small issue admittedly, but I feel like it would make the overall experience more pleasing.

@Maetveis
Copy link
Author

Maetveis commented Sep 7, 2023

Is this related to #1186? The main issue for me right now is that when just echos the command that it's running, it prints it in white, and this gets lost amongst the other output. It is a small issue admittedly, but I feel like it would make the overall experience more pleasing.

Perhaps slightly, the feature proposed here could be used to decide in a recipe whether to use the {{color}}/{{\color}} "tags" proposed in #1186, but implementation wise I'd think they are not related.

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

No branches or pull requests

2 participants