Fix mid-word truncation of Go CLI command descriptions - #265
Merged
rich-iannone merged 1 commit intoJul 17, 2026
Merged
Conversation
The CLI reference index page showed each command's summary via `short_help`,
which for Cobra commands was a hard `description[:80]` slice. Cobra's root and
group `--help` output carries the full (Long) description, so the summary was
cut mid-word with no ellipsis, e.g.:
velocirepo tracks your open-source project's pulse across package registries, Gi
Introduce a `_short_help()` helper that prefers the first sentence and
otherwise truncates on a word boundary with an ellipsis, using the same 150-char
limit and "..." placeholder as the Click path's `get_short_help_str(limit=150)`
so both ecosystems read consistently.
Add unit tests covering the empty, short, first-sentence, long-single-sentence
(word-boundary + ellipsis), and within-limit cases.
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.
Problem
On the CLI reference index page (
/reference/cli/), a Go CLI's command summary was cut off mid-word with no ellipsis:The summary (
short_help) for Cobra commands was built with a harddescription[:80]slice in_go_cli.py. Cobra's root and group--helpoutput carries the full (Long) description, so slicing the first 80 characters cut it mid-word.(Subcommands were unaffected — their summaries come from Cobra's concise "Available Commands" listing. The Click CLI path already handled this correctly via
get_short_help_str(limit=150); the Go path just didn't match it.)Fix
Introduce a
_short_help()helper that prefers the first sentence and otherwise truncates on a word boundary with an ellipsis, using the same 150-char limit and...placeholder as the Click path so both ecosystems read consistently.Testing
TestShortHelpcovering the empty, short, first-sentence, long-single-sentence (word-boundary + ellipsis), and within-limit cases.tests/test_go_cli.pytests pass....instead of a mid-word cut.