Skip to content

docs: state the root package's stdlib-only scope and what cobrahelp does - #1

Merged
datapointchris merged 1 commit into
mainfrom
fixer/audit-rewrites-gotermstyle
Oct 20, 2026
Merged

datapointchris merged 1 commit into
mainfrom
fixer/audit-rewrites-gotermstyle

Conversation

@datapoints-fleet-automation

Copy link
Copy Markdown
Contributor

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 continue taken when typeable(cmd) is non-empty, that the commandSections comment matches strings.TrimSuffix(group.Title, ":"), and that the Install comment matches cobra.EnableCommandSorting = false. The doc comment on unexported write is 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 tidy annotation 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 --fix named 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.

go test ./... && go vet ./... && golangci-lint run ./... && rg -c -F -e "The module requires nothing outside the standard library" -e "its execution and its help function" -e "leafRows is every runnable command" -e "which is why one call in the file" -e "Every title ends in" -e "something has to cut it" . || echo "no superseded passage remains"
ok  	github.com/datapointchris/gotermstyle	0.007s
ok  	github.com/datapointchris/gotermstyle/cobrahelp	0.002s
0 issues.
no superseded passage remains

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

  • The leafRows comment describes the code, and the code is unchanged — a runnable namespace gets no row of its own today. The comment says so instead of claiming it does. Listing such a namespace would change rendered help, so it was left out of a docs change.

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.

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.
@datapointchris
datapointchris merged commit 0b27a9e into main Oct 20, 2026
2 checks passed
@datapointchris
datapointchris deleted the fixer/audit-rewrites-gotermstyle branch October 20, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant