Skip to content

feat(cli): show examples and a guide link in every command's help - #27

Open
thebrandonlucas wants to merge 1 commit into
docs/cli-guidesfrom
feat/cli-help-examples
Open

thebrandonlucas wants to merge 1 commit into
docs/cli-guidesfrom
feat/cli-help-examples

Conversation

@thebrandonlucas

Copy link
Copy Markdown
Contributor

Stack: master ← #20 ← #22 ← #24 ← #19 ← #26 ← this PR. Plan 07, phase 4 (help). Links to the wallet and webhook guides from #26.

Help Before After
Examples payments send, payments receive, wallets create Every command that changes something and every alias, plus login, auth import-key, profiles create, context, convert, payments get --wait, checkout events watch; each under a # comment
-h Usage, options, and all notes Usage and options only
--help Same as -h Adds notes, examples, and Learn more:
Guide link None Learn more: https://github.com/voltagecloud/voltage-cli/blob/v<version>/docs/<guide>, pinned to the running release
Root help Commands and options Adds common commands, the --execute rule, and a docs link

Examples live in one table keyed by OperationId (endpoint_examples) plus local_examples for the CLI's own commands, so the parse test and help share one source.

Tests:

  • Every non-GET operation and payment alias has at least one commented example in --help.
  • Every command's Learn more link names a page that exists under docs/.
  • -h shows no notes.
  • The existing parse test now reads commented, multi-line examples and drops redirections, so every help example still parses and every change passes --execute or --dry-run.

Validation: cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo machete --with-metadata, cargo test --locked (95 unit, 69 integration), and python3 scripts/check-coverage.py.

Limit: links pin to the release tag, so a development build of an unreleased version links to pages that only exist once that version is tagged.

Every command that changes something now has examples in --help, each
under a # comment that says what it does, as do login, auth import-key,
profiles create, context, convert, payments get --wait, and checkout
events watch.

-h stays short: usage and options. --help adds the notes (request body,
friendly flags, scope, feature requirement, examples) and a Learn more link
to the command's guide in the docs of the running release. The root help
lists common commands and links the documentation.

Tests require an example for every change command and every alias, a
Learn more link on every command that names an existing docs page, and no
notes under -h.
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