Repository navigation
docs: state the root package's stdlib-only scope and what cobrahelp does - #1
Merged
Merged
Conversation
The cobrahelp package added cobra and pflag to go.mod. README.md still said the module requires nothing outside the standard library, and that the caller keeps its help function, which cobrahelp.Install replaces. Both now scope the claim to the root package. The go mod tidy annotation drops its claim that go.sum gains no other lines. In cobrahelp.go, leafRows gives a command with children no row even when it runs, Install's sorting switch is named as affecting every command tree in the process, and the section-title comment matches the code's TrimSuffix of a trailing colon. The doc comment restating write's signature is gone. CLAUDE.md folds the two release paragraphs that stated one fact and drops a sentence repeating the bullet above it. Two test comments and the .markdownlintignore note now state the observable they guard.
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.
Since cobrahelp landed, the docs make claims the code contradicts. README.md says the module requires nothing outside the standard library, but go.mod requires cobra v1.10.2 and pflag v1.0.10. It also says the caller keeps its help function, but cobrahelp.Install calls root.SetHelpFunc and root.SetUsageFunc. In cobrahelp.go, leafRows claims to list every runnable command, yet it skips a namespace that has a Run. The comment on Install presents the process-wide cobra.EnableCommandSorting switch as a convenience and hides that it affects every command tree in the process. A reader who trusts these comments picks the wrong dependency footprint, or misses a command on a help screen and doesn't know why. Thirteen passages in five files had these faults, plus some duplicated or empty prose.
Rewrites 13 passages in README.md, CLAUDE.md, cobrahelp/cobrahelp.go, screen_test.go and .markdownlintignore so each states what the code does. The README now scopes the standard-library-only claim to the root package, and it says that cobrahelp.Install replaces the caller's help function. The only change to Go source is in comments.
What to look at
bcd1b89 cobrahelp/cobrahelp.go — check that the leafRows comment matches the
continuetaken when typeable(cmd) is non-empty, that the commandSections comment matchesstrings.TrimSuffix(group.Title, ":"), and that the Install comment matchescobra.EnableCommandSorting = false. The doc comment on unexportedwriteis removed.bcd1b89 README.md — the dependency claim and the help-function claim are scoped to the root package and checked against go.mod and Install. The
go mod tidyannotation no longer claims go.sum gains nothing else.bcd1b89 CLAUDE.md — the two release paragraphs are merged into one, and a sentence that repeated the bullet above it is gone.
bcd1b89 screen_test.go, .markdownlintignore — the comments now name what the test or the entry guards against. The
--fixnamed in .markdownlintignore is the markdownlint hook's arg in .pre-commit-config.yaml.How it was verified
All three commands return clean: tests, vet and lint pass, and no superseded passage is left in the tree. No test was added, because only comments and docs changed.
What changes
Nothing observable changes. Only comments and docs changed. A reader of the README now learns that importing cobrahelp brings in cobra and pflag, and that Install takes over the help and usage functions.
Decisions, and what they rejected
What this does not do
The code skips a namespace that has a Run of its own, so no help screen lists it. This change documents that behavior and does not change it.