fix(docs): strip authored ANSI from plain help - #1357
Merged
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
jdx
enabled auto-merge (squash)
September 1, 2026 15:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Style::PLAINremove ANSI CSI sequences already embedded in authored helpusage-argvandusage-librenderers in parity without adding argv dependenciesThis lets adopters such as mise select plain rendering after resolving their own color policy, even when clap-era
color_print::cstr!help remains in command metadata.Addresses the renderer behavior behind jdx/mise#12671.
Verification
mise run cicargo test -p gate --test fleet every_jdx_cli_matches_the_referenceAI-assisted — Tool: Codex; model: openai/gpt-5; version: unavailable.
Note
Low Risk
Output-formatting change limited to stripping escape bytes on plain paths; coloured terminal help is unchanged aside from shared finalization.
Overview
Plain help and docs no longer leak ANSI escapes that were already baked into command metadata (typical when migrating from clap/
color_print::cstr!in fields likeafter_long_help).The usage-argv renderer centralizes page finalization in
finish_page: whenStyle::PLAINis selected it strips complete CSI sequences before trim/newline, while coloured output keeps both renderer styling and any authored escapes. The Go argv renderer applies the same rule inassembleviastripANSISequences, since it only emits plain pages.usage-lib adds a shared
docs::strip_ansihelper (regex-based) and wires it into CLI plain rendering and Markdown generation, replacing a duplicate SGR regex in the markdown renderer.Style::PLAINis documented to include this sanitization.Tests cover Rust argv, Go argv, and usage-lib styled vs plain behaviour for authored ANSI in long help.
Reviewed by Cursor Bugbot for commit 718cd86. Bugbot is set up for automated code reviews on this repo. Configure here.