Skip to content
Myr

Merge stable into main (#3031)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Rowlando13 · committed by GitHub · parents 5926f83, 4f936ac · Browse files · 3 files+21 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+21 added−0 removed

  • tests:+13 added−0 removed
  • other:+8 added−0 removed

3 files+21 added−0 removed

modified:src/click/shell_completion.py+1 added
550 unmodified lines
551 break552553 if _start_of_option(ctx, arg):554 last_option = arg555 break556557 return last_option is not None and last_option in param.opts558559
106 unmodified lines
modified:tests/test_shell_completion.py+13 added
218 unmodified lines
219 # flag option doesn't take value, use choice argument220 assert _get_words(cli, ["--on"], "a") == ["a1", "a2"]221222223def test_flag_option_with_nargs_option():224 cli = Command(225 "cli",226 add_help_option=False,227 params=[228 Argument(["a"], type=Choice(["a1", "a2", "b"])),229 Option(["--flag"], is_flag=True),230 Option(["-c"], type=Choice(["p", "q"]), nargs=2),231 ],232 )233 assert _get_words(cli, ["a1", "--flag", "-c"], "") == ["p", "q"]234235236def test_option_custom():237 def custom(ctx, param, incomplete):238 return [incomplete.upper()]239
321 unmodified lines
modified:CHANGES.rst+7 added
1.. currentmodule:: click23Version 8.2.x4-------------56Unreleased78- show correct auto complete value for nargs option in combination with flag option :issue:`2813`910Version 8.2.211-------------1213Released 2025-07-31
1261 unmodified lines