Skip to content

Bash completion understands options even after "--" #1247

@bertolinocastro

Description

@bertolinocastro

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    f:completionfeature: shell completion

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions