Improve help presentation and usage#716
Open
ardnew wants to merge 3 commits into
Open
Conversation
- move help handling to an embedded CLI help catalog - support 'help cmd' and 'cmd --help' for each subcommand - add internal/clihelp with embedded YAML definitions and renderer - route help paths through clihelp before docopt parsing in main - add CLI help coverage (resolver/renderer/loader tests + golden outputs) - refresh README help section with generated current output and markers - add `make readme-help` target to regenerate the README help block - promote gopkg.in/yaml.v3 to a direct dependency in go.mod Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR replaces the existing docopt-generated CLI help output with a curated, consistently formatted help renderer backed by an embedded YAML catalog, and adds golden tests to lock the output format in place. It also updates the README to present the new help output and adds a Makefile target to regenerate the README help block.
Changes:
- Add
internal/clihelp(embeddedhelp.yaml) to resolve and render global/subcommand help with aligned formatting. - Intercept
ios,--help/-h, andhelp <topic>invocations early inmain.goto emit the new help output. - Add golden tests and fixtures for global and subcommand help; update README and add
make readme-helpto refresh the README help section.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
main.go |
Loads the new help catalog and handles help requests before docopt parsing. |
internal/clihelp/help.go |
Implements YAML loading, help-topic resolution, and formatted rendering. |
internal/clihelp/help.yaml |
Defines the canonical help catalog (usage, global options, commands). |
internal/clihelp/*_test.go |
Adds unit tests for catalog loading, resolution, and rendering basics. |
main_test.go |
Adds golden-based integration tests by running the CLI and comparing outputs. |
testdata/help/global.golden |
Golden output for top-level help formatting. |
testdata/help/apps.golden |
Golden output for apps subcommand help formatting. |
README.md |
Replaces prior long help text with a bounded help block containing the new output. |
Makefile |
Adds readme-help target to regenerate the README help block. |
go.mod |
Promotes gopkg.in/yaml.v3 to a direct dependency and normalizes Go version line. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Per Copilot, BSD/macOS `mktemp` requires a template or `-t`. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
I should preface this by stating
danielpaulus/go-iosis fantastic. Very reliable with an amazing toolset. Kudos to all contributors.That being said, the command-line help really is just awful. It is nearly impossible to find syntax for any given subcommand, and the egregiously long lines makes it a nightmare to follow in any terminal.
This sort of tedious work is exactly what I like to burden AI agents with.
The changes include tests against a pair of golden outputs you can quickly review to see how the top-level help and individual subcommand help is formatted.
See the commit message for a description of changes.