Use cog to auto-generate --help output in README#9
Merged
Conversation
Replace the manually maintained Usage/Global options/Exec output/Popping entries sections with a single cog block that runs `go run . --help` and embeds the full help text in a fenced code block. This keeps the README in sync with the actual CLI help output. https://claude.ai/code/session_011LqtVUFCcVLs2LBuvZZpFW
Extract the --help text from an inline Go string literal to help.txt, embedded at compile time via //go:embed. This makes the help text easier to maintain and eliminates backtick escaping workarounds. Add sections for Image, Verify, and Extract commands with details agents need (exit codes, --output flag, --filename flag). Add a concrete exit code example to the Exec section. The README now uses a cog block that runs `go run . --help` to generate the help text, keeping docs in sync with the actual binary output. https://claude.ai/code/session_011LqtVUFCcVLs2LBuvZZpFW
Update the resulting markdown format in help.txt to match the example: show python3 (not python) since the example pops the python exec and redoes it with python3, and include the image output. Add a CI step that runs `cog --check README.md` to catch cases where help.txt is updated but cog hasn't been re-run on the README. https://claude.ai/code/session_011LqtVUFCcVLs2LBuvZZpFW
The help text contains triple-backtick code blocks in its "Resulting markdown format" section, so the outer fence needs four backticks to render correctly. https://claude.ai/code/session_011LqtVUFCcVLs2LBuvZZpFW
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.
Replace the manually maintained Usage/Global options/Exec output/Popping entries sections with a single cog block that runs
go run . --helpand embeds the full help text in a fenced code block. This keeps the README in sync with the actual CLI help output.https://claude.ai/code/session_011LqtVUFCcVLs2LBuvZZpFW