Should CI environments infer `ColorChoice::Always`?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start by reading crates/anstream/src/auto.rs at the linked lines and trace how raw.is_terminal() and anstyle_query::is_ci() determine the color choice. Resolve whether CI alone should select ColorChoice::Always, including the noted ANSI and OSC-code concerns, and verify the resulting behavior in CI and non-terminal environments.
Written by the indexing model from the issue text.
Description
Context: I was trying to figure out why CI environments (i.e. CI=true and similar) weren't being colorized by default when using anstream to plumb output containing ANSI colors. I ended up on this choice implementation:
If my read of that helper is right, the current logic only considers anstyle_query::is_ci() after raw.is_terminal() is satisfied. In practice that means that ColorChoice::Always branch won't be taken for CI environments, since (AFAIK) most CI environments don't actually provide a terminal (they support ANSI color codes, but they won't provide a true pty that would pass is is_terminal() check).
Given that, does it makes sense to split that check out, so that is_ci() becomes a sufficient condition for ColorChoice::Always? My intuition is "yes" (since the CI check seems to be a no-op as is), but there's also some nuance given that CI environments aren't real terminals and might only support a small subset of the escapes normally accepted by terminals (things like OSC codes in particular).
So, I don't have a super clear sense here, but I figured I'd open this in case others have a clearer picture than I do 😅. If this change makes sense, I'd be happy to send a PR for it.
- Dominant language
- HTML
- Stars
- 171
- Forks
- 44
- Avg merge
- 3h 4m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-cli/anstyle
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
A-stream
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
A-stream C-bug S-triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in rust-cli/anstyle
Similar issues
-
discover: `sudo RTK_DISABLED=$VAR …` is not detected as a bypass when `sudo` is a transparent prefixOpenarea:cli bug good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
filamentphp/filament#20630 ·
Maintainers usually reply within 1 day
-
component:ktuner
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
agentic-os-org/ANOLISA#4109 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
lawndoc/stack-back#121 ·
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day