Skip to content

AI junk - #3795

Closed
arpansahu wants to merge 1 commit into
pallets:mainfrom
arpansahu:fix/shell-completion-equals-values
Closed

AI junk#3795
arpansahu wants to merge 1 commit into
pallets:mainfrom
arpansahu:fix/shell-completion-equals-values

Conversation

@arpansahu

Copy link
Copy Markdown

Problem

Completing a long option value written with = loses the option name. For a choice option such as --color, shell completion for --color=a returns auto and always, which can replace the whole current word instead of preserving --color=.

Closes #2847

Reproducer

$ _CLI_COMPLETE=bash_complete COMP_WORDS="cli --color=a" COMP_CWORD=1 cli
# before: plain,auto
# before: plain,always
# expected: plain,--color=auto
# expected: plain,--color=always

Fix

Track the --option= prefix while resolving an incomplete option value, use the value after = for matching, then add the prefix back to plain completion items before shell-specific formatting.

Testing

Added test_long_option_equals_value_completion covering bash, zsh, and PowerShell. Ran:

python -m pytest tests\test_shell_completion.py::test_long_option_equals_value_completion -q
python -m pytest tests\test_shell_completion.py -q
python -m pytest

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: arpan sahu <28574248+arpansahu@users.noreply.github.com>
@davidism davidism closed this Aug 27, 2026
@davidism davidism added the rejected AI Contribution rejected because of its untrustworthy AI origin label Aug 27, 2026
@davidism davidism changed the title Fix equals option value completion AI junk Aug 27, 2026
@davidism

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected AI Contribution rejected because of its untrustworthy AI origin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Long option completion with = broken

2 participants