Skip to content

fix(cli): accept --all on environments, organizations, and profiles list - #120

Open
thebrandonlucas wants to merge 2 commits into
masterfrom
brandon/dev-2954-voltage-cli-accept-all-on-environments-list-and-stop
Open

thebrandonlucas wants to merge 2 commits into
masterfrom
brandon/dev-2954-voltage-cli-accept-all-on-environments-list-and-stop

Conversation

@thebrandonlucas

Copy link
Copy Markdown
Contributor

Problem

voltage environments list --org ORG --all failed with exit code 2: unexpected argument '--all' found. #94 made API lists without paging, such as wallets list, accept --all and ignore it. The local lists are clap-derived subcommands, not registry operations, so #94 did not reach them. organizations list and profiles list had the same failure.

Change

Command Before After
environments list --all exit 2, unexpected argument accepted, ignored
organizations list --all exit 2, unexpected argument accepted, ignored
profiles list --all exit 2, unexpected argument accepted, ignored
profiles get NAME --all, context --all rejected still rejected
  • src/cli.rs: the --all argument from feat(cli): accept --all on lists that return every item at once #94 moves into all_at_once_arg(). The registry lists and the two local List variants (ListCommand::List, ProfileCommand::List) use it. The help text is now "No effect: this list shows every item at once", which is also true for the local profiles list.
  • Tests: all_is_accepted_by_every_list_command walks the whole command tree and fails if any list subcommand has no --all, so a new list cannot miss it. all_is_ignored_by_local_lists_and_rejected_by_other_local_commands tests the three local lists and the rejection path for local commands that are not lists. Both tests fail without the fix.
  • CHANGELOG.md (Unreleased) and docs/guides/requests.md (Paging) are updated.

About --wallet <UUID> in the usage line

That usage line is not a real requirement. When clap suggests a similar flag (--all → --wallet), Parser::did_you_mean_error in clap_builder 4.6.7 adds the suggested argument to the matches "to build a proper usage string". So the usage line names the suggestion as if it were given. voltage environments list --walle shows the same line. Now that --all is accepted, this command no longer prints that suggestion. The clap behavior for other typos is out of scope here.

Closes #119
Linear: DEV-2954

Checks

  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo machete --with-metadata, cargo test --locked (199 unit + 149 integration tests pass), python3 scripts/check-coverage.py: all pass.
  • I removed the fix and confirmed that both new tests fail.
  • Manual run: environments list --all and organizations list --all now get past parsing and stop at the missing credential (exit 3). profiles get x --all is still rejected.
  • CRAP report (scripts/crap-report.sh, cargo-llvm-cov 0.8.5, knots 1.16.0): 0 violations. The highest score is 18.10 (src/api.rs wait_for_payment, unchanged). No function scores 20 or more. endpoint in src/cli.rs is at 18.00 and this PR does not change it.
  • The voltage-pr-review self-review led to one fix: the help text no longer says "response", because profiles list is local.
  • Not run: the Windows CI job (no Windows host). There are no live or staging checks because the change is offline only.

These local lists return every item at once but rejected --all, unlike the
API lists fixed in #94. They now accept it and ignore it, through the same
argument. A test walks the command tree so a new list cannot miss --all.

Closes #119.
tee8z
tee8z previously approved these changes Oct 26, 2026

@tee8z tee8z left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One all_at_once_arg() serves the registry lists and the local lists. The tree walk in all_is_accepted_by_every_list_command keeps a future list from missing --all, and the second test covers the rejection path. The changelog and the Paging docs are updated.

@thebrandonlucas
thebrandonlucas marked this pull request as ready for review October 29, 2026 12:26
…ltage-cli-accept-all-on-environments-list-and-stop

# Conflicts:
#	CHANGELOG.md
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.

environments list rejects --all and suggests --wallet

2 participants