Skip to content

fix(clap_complete): handle hyphenated bin names in bash completions - #6538

Closed
00200200 wants to merge 1 commit into
clap-rs:mainfrom
00200200:codex/clap-bash-hyphen-completion
Closed

00200200 wants to merge 1 commit into
clap-rs:mainfrom
00200200:codex/clap-bash-hyphen-completion

Conversation

@00200200

Copy link
Copy Markdown

What does this PR try to solve?

Closes #6386. For a binary named my-app, the Bash generator normalized the root function name to my__app but also converted the hyphen in the root command path into a __subcmd__ separator. As a result, the command-state strings could not match the generated nested-subcommand handlers, so completion stopped after entering the command. Normalize the root path consistently with the function name.

Notes to reviewers

The existing custom_bin_name Bash snapshot covers a hyphenated binary and nested subcommands; the other affected Bash snapshots now assert the corrected handler names.

Validation: cargo test -p clap_complete --test testsuite (77 passed); cargo fmt --check.

LLM involvement: AI-assisted implementation and tests; the regression is covered by the generated-script snapshots.

@00200200
00200200 force-pushed the codex/clap-bash-hyphen-completion branch from 4bd42c8 to 2846166 Compare September 27, 2026 18:15
@epage

epage commented Sep 28, 2026

Copy link
Copy Markdown
Member

Our LLM policy specifically says that anything touching completion shell scripts cannot be AI generated.

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.

Completions for subcommand not working after second or third subcommand

2 participants