fix(cli): Colorize example sections in help output#1008
Merged
Conversation
Change build_description to produce "{heading} examples:" format
(e.g., "load examples:") instead of "{heading}:" (e.g., "load:").
The formatter's colorization logic uses content_lower.endswith("examples:")
to detect example section headings. Without the "examples:" suffix,
section headings like "load:" were not recognized and colorization
never triggered.
This aligns with vcspull's implementation which uses the same pattern.
Add tests to verify build_description produces correct heading format: - Named headings include "examples:" suffix for formatter detection - None heading produces bare "examples:" title - Multiple named headings all have suffix - Empty intro doesn't add blank sections
Add tests to verify formatter correctly colorizes section headings ending with "examples:" even without an initial "examples:" block: - Single "X examples:" heading is colorized - Multiple "X examples:" sections are all colorized
Add integration tests to verify: - Main --help has section headings with "examples:" suffix - Example sections are colorized when FORCE_COLOR is set Also update comment to reflect the new heading format.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1008 +/- ##
=======================================
Coverage 80.11% 80.11%
=======================================
Files 28 28
Lines 2409 2409
Branches 457 457
=======================================
Hits 1930 1930
Misses 356 356
Partials 123 123 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
tmuxp --helpoutputbuild_descriptionheadings for formatter detectionProblem
The
tmuxp --helpoutput wasn't highlighting example sections (likeload:,freeze:, etc.) whilevcspull --helpcorrectly colored them.Root cause: The
build_descriptionfunction produced headings like"load:"instead of"load examples:". The formatter's colorization logic usescontent_lower.endswith("examples:")to detect section headings, so"load:"was never recognized.Solution
Changed
build_descriptionto usef"{heading} examples:"format (matching vcspull):Test plan
uv run ruff check . --fix --show-fixesuv run ruff format .uv run mypyuv run py.test --reruns 0 -vvv(736 passed)FORCE_COLOR=1 tmuxp --helpshows colored examples