Hi there,
Thanks for the fantastic library! 😃 Small bug report: I am encountering some issues with completing arguments that contain whitespace:
@click.command()
@click.option("--foo", type=click.Choice(["Foo Bar", "Foo Qux"]))
def cli(foo):
print(foo)
λ cli --foo
<TAB>
λ cli --foo Foo\
<TAB>
(nothing changes and no options are displayed)
click-completion: 0.5.2
shell: fish
My suspicion was that the .endswith check here could be culprit:
|
args = split_args(commandline)[1:] |
|
if args and not commandline.endswith(' '): |
|
incomplete = args[-1] |
|
args = args[:-1] |
|
else: |
|
incomplete = '' |
I patched
split_args to return an
(args, incomplete) tuple,
but that did not cut it (edit: see below). Given that the changes got rather messy at this point, I stopped here hoping there might be an easier fix. :)
Hi there,
Thanks for the fantastic library! 😃 Small bug report: I am encountering some issues with completing arguments that contain whitespace:
click-completion: 0.5.2
shell: fish
My suspicion was that the
.endswithcheck here could be culprit:click-completion/click_completion/core.py
Lines 191 to 196 in 6e08a5f
split_argsto return an(args, incomplete)tuple,but that did not cut it(edit: see below). Given that the changes got rather messy at this point, I stopped here hoping there might be an easier fix. :)