Click Bash Completion prints out command's options for any string starting with a single dash even after the double dash separator.
I'm facing this problem because I'm trying to create a wrapper with Click and I would like to use Click's auto completion to print out options from my wrapped program.
So, supposing that I'm wrapping git and my program is called logbuch, my command line would be something like:
logbuch -g -- commit -<TAB>
Supposing I'm doing some workaround in-code to get the git commit's options, I'm returning that as a list of strings from a callback to my command argument autocompletion param. Like this:
@click.argument('arg',nargs=-1,type=click.STRING,autocompletion=auto_comp_callback)
Is there any way to prevent Click from completing my program's options instead of calling my callback? I have read this code and it sounds like that Click does not check for double dashes before calling the start_of_option at line 246.
Besides that, I think that this issue goes in opposite way to this statement at Click docs: " After the -- marker, all further parameters are accepted as arguments."
I'm using python3.7 with Click installed by python3.7 -m pip install click.
Click Bash Completion prints out
command's options for any string starting with a single dash even after the double dash separator.I'm facing this problem because I'm trying to create a wrapper with Click and I would like to use Click's auto completion to print out options from my wrapped program.
So, supposing that I'm wrapping
gitand my program is calledlogbuch, my command line would be something like:Supposing I'm doing some workaround in-code to get the
git commit's options, I'm returning that as a list of strings from a callback to mycommandargumentautocompletionparam. Like this:@click.argument('arg',nargs=-1,type=click.STRING,autocompletion=auto_comp_callback)Is there any way to prevent Click from completing my
program's options instead of calling mycallback? I have read this code and it sounds like that Click does not check for double dashes before calling thestart_of_optionat line 246.Besides that, I think that this issue goes in opposite way to this statement at Click docs: " After the
--marker, all further parameters are accepted as arguments."I'm using
python3.7with Click installed bypython3.7 -m pip install click.