Skip to content

Strip trailing blank line from generated CLI docs#14

Merged
murrayju merged 1 commit into
mainfrom
murrayju/generate-docs-trim-eof
May 15, 2026
Merged

Strip trailing blank line from generated CLI docs#14
murrayju merged 1 commit into
mainfrom
murrayju/generate-docs-trim-eof

Conversation

@murrayju
Copy link
Copy Markdown
Member

@murrayju murrayju commented May 14, 2026

Cobra's doc.GenMarkdownTree emits files that end with a blank line (...text\n\n). git diff --check flags that as a whitespace error whenever a doc gets added or its tail modified — e.g. the doc EOF issues called out in the review of #13.

Fix: post-process generated markdown in cmd/generate-docs to collapse trailing newlines down to a single \n, and regenerate every CLI doc to match. Future regenerations stay clean automatically.

The 52 doc-file changes are mechanical (one trailing newline removed each); the only behavior change is in cmd/generate-docs/main.go.

Cobra's markdown generator emits files ending with a blank line, which
trips 'git diff --check' whenever a doc gets modified near EOF. Add a
post-processing pass to generate-docs that collapses trailing newlines
to a single \n, and regenerate every doc to match.
@murrayju murrayju merged commit 7d478f4 into main May 15, 2026
2 checks passed
@murrayju murrayju deleted the murrayju/generate-docs-trim-eof branch May 15, 2026 21:49
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.

2 participants