Skip to content

Commit 71cec9c

Browse files
committed
add test for flag with naargs option auto completion
1 parent 22c0738 commit 71cec9c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/test_shell_completion.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,19 @@ def test_option_flag():
186186
assert _get_words(cli, ["--on"], "a") == ["a1", "a2"]
187187

188188

189+
def test_flag_option_with_nargs_option():
190+
cli = Command(
191+
"cli",
192+
add_help_option=False,
193+
params=[
194+
Argument(["a"], type=Choice(["a1", "a2", "b"])),
195+
Option(["--flag"], is_flag=True),
196+
Option(["-c"], type=Choice(["p", "q"]), nargs=2),
197+
],
198+
)
199+
assert _get_words(cli, ["a1", "--flag", "-c"], "") == ["p", "q"]
200+
201+
189202
def test_option_custom():
190203
def custom(ctx, param, incomplete):
191204
return [incomplete.upper()]

0 commit comments

Comments
 (0)