Open
Conversation
Add a StyledHelpFormatter that applies ANSI formatting to CLI help: - Bold section headings (Options:, Commands:, etc.) - Yellow 'Usage:' prefix with bold program name - Cyan command/option names in definition lists - Dim example lines ($ hf ...) - Bold epilog headings (Examples, Learn more) ANSI codes are only emitted when stdout is a TTY, the process is not driven by an AI agent, and NO_COLOR is not set. Co-authored-by: Lucain <Wauplin@users.noreply.github.com>
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
- Replace raw ANSI escape codes with the existing ANSI utility class - Add ANSI.dim() to the shared helper - Remove cyan styling from definition list entries - Fix false-positive bolding of description text (only bold epilog headings at indent level 0) Co-authored-by: Lucain <Wauplin@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dc1ba71. Configure here.
Member
|
i like it!! |
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.

Related to private slack thread: https://huggingface.slack.com/archives/C0ACCEFPU9W/p1777986048386859
This PR highlights a bit more the sections and commands in the help section of the CLI.
Mainly:
Also update
ANSIhelper to never return formatted strings when running in agent mode.hf --help
hf upload --help
Slack Thread
Note
Low Risk
Low risk: changes are limited to CLI
--helpformatting and ANSI styling behavior (now disabled in agent/NO_COLOR contexts), with no impact on Hub API calls or data handling.Overview
Improves
hf ... --helpreadability by introducing a custom Click help formatter that underlines section headings and bolds option/command names, and wiring it in via a newStyledContextused by the main Typer group and generated commands.Extends the
ANSIterminal helper withunderline()and ensures ANSI codes are never emitted whenNO_COLORis set or when running under a detected AI agent (is_agent()).Reviewed by Cursor Bugbot for commit 9504648. Bugbot is set up for automated code reviews on this repo. Configure here.