--color does not control the dry-run diff's colors
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Read crates/bumpversion-cli/src/common.rs for how --color sets the override, then inspect crates/bumpversion/src/files.rs where similar_asserts::SimpleDiff produces the dry-run diff. Apply the color setting to the console crate as the issue describes and check both --color always and --color never with a piped dry run; done means the diff follows the flag for the whole output.
Written by the indexing model from the issue text.
Description
--color does not control the colors of the dry-run report's diff ("Differences (-before|+after)"). The diff comes from similar_asserts::SimpleDiff in crates/bumpversion/src/files.rs, which colors through the console crate, while --color only sets colored::control::set_override in crates/bumpversion-cli/src/common.rs. So the diff follows console's own detection (a TTY, CLICOLOR_FORCE), not the flag:
$ bumpversion --color always --dry-run -vv patch 2>&1 | cat -v | grep -A1 Differences
^[[34m [DRY-RUN] ^[[0m Differences (-before|+after):^[[0;0m
^[[34m [DRY-RUN] ^[[0m -1.0.0^[[0;0m
$ CLICOLOR_FORCE=1 bumpversion --color never --dry-run -vv patch 2>&1 | cat -v | grep -A1 Differences
[DRY-RUN] ^[[1mDifferences^[[0m (^[[31m^[[2m-^[[0m^[[31mbefore^[[0m|^[[32m^[[2m+^[[0m^[[32mafter^[[0m):^[[0;0m
[DRY-RUN] ^[[31m^[[1m^[[2m-^[[0m^[[31m^[[1m^[[4m1.0.0^[[0m^[[31m^[[0;0m
--color always leaves a piped diff plain, which is why the docs capture script has to set CLICOLOR_FORCE=1, and --color never still colors it.
Expected: --color decides for the whole output. Calling console::set_colors_enabled(use_color) (and set_colors_enabled_stderr) next to colored::control::set_override(use_color) would do it.
- Dominant language
- Rust
- Stars
- 1
- Forks
- 0
- Avg merge
- 12m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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 romnn/bumpversion
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
romnn/bumpversion#10 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
romnn/bumpversion#9 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
romnn/bumpversion#8 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
romnn/bumpversion#7 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
romnn/bumpversion#5 ·
All issues in romnn/bumpversion
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ardia-browser/ardia#5810 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
UIUX の修正Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
aptos-labs/aptos-core#21119 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 8 days