Skip to content

fix(complete): Prefer subcommand names over aliases#6354

Open
cyphercodes wants to merge 1 commit intoclap-rs:masterfrom
cyphercodes:fix-6317-dynamic-complete-alias-precedence
Open

fix(complete): Prefer subcommand names over aliases#6354
cyphercodes wants to merge 1 commit intoclap-rs:masterfrom
cyphercodes:fix-6317-dynamic-complete-alias-precedence

Conversation

@cyphercodes
Copy link
Copy Markdown

Summary

  • keep dynamic subcommand completion candidates in declaration/display order before id de-duplication
  • prefer a subcommand's primary name over a matching visible alias when only one candidate is shown
  • add a regression test for install / visible alias i

Fixes #6317

Testing

  • cargo fmt --all --check
  • cargo test -p clap_complete --features unstable-dynamic --test testsuite engine::
  • cargo test -p clap_complete --features unstable-dynamic --test testsuite
  • cargo test -p clap_complete --features unstable-dynamic

@cyphercodes cyphercodes force-pushed the fix-6317-dynamic-complete-alias-precedence branch from 680fb87 to c32cb30 Compare April 28, 2026 04:01
@cyphercodes cyphercodes changed the title fix(complete): prefer subcommand names over aliases fix(complete): Prefer subcommand names over aliases Apr 28, 2026
@epage
Copy link
Copy Markdown
Member

epage commented Apr 28, 2026

note that our contrib guide encourages a fairly specific commit structure. I've written up more on it at https://epage.github.io/dev/pr-style/#c-test

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.

Some visible aliases missing in dynamic completion

2 participants