[Feature] Expose --color to as variable/function
Open
- Dominant language
- Rust
- Stars
- 35.8k
- Forks
- 846
- Avg merge
- 27m
- Merged PRs (30d)
- 3
Description
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):
```justfile
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.
Contributor guide
Assessment
This issue has not been assessed yet.