fix(cli): prevent mid-word truncation in winml --help summaries#816
Open
ziyuanguo1998 wants to merge 1 commit into
Open
fix(cli): prevent mid-word truncation in winml --help summaries#816ziyuanguo1998 wants to merge 1 commit into
ziyuanguo1998 wants to merge 1 commit into
Conversation
LazyGroup.format_commands was hard-slicing help text at a fixed character count, landing mid-word (e.g. "…model or .on"). Instead, pass the full first docstring line to Click's write_dl, which wraps at word boundaries with proper indentation, respecting terminal width. Add regression tests to ensure complete summaries appear in --help output at any terminal width, with no mid-token cuts.
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
Fixes #511.
winml --helptruncated each subcommand summary mid-word becauseLazyGroup.format_commandshard-sliced the help text at a fixed charactercount (
help_text[:limit]), landing inside a token — e.g.buildrendered as…HuggingFace model or .on.Fix
Drop the manual character-slice truncation and hand the full first docstring
line to Click's
HelpFormatter.write_dl, which already wraps long descriptionsat word boundaries with a hanging indent, respecting terminal width. The
zero-import AST extraction of the help text is unchanged.
Before:
After:
Tests
Adds
TestNoMidWordTruncationintests/cli/test_help_cli.py:--helpoutput, never truncatedtests/cli/passes (223 passed).🤖 Generated with Claude Code