kislyuk / argcomplete

Python and tab completion, better together.
https://kislyuk.github.io/argcomplete/
Apache License 2.0
1.39k stars 129 forks source link

zsh does behave weird if choice contains colon #456

Closed maurerle closed 7 months ago

maurerle commented 7 months ago

I have a list of choices:

parser.add_argument(
        "-db",
        "--db-uri",
        help="uri string for a database",
        default="",
        type=str,
        choices=[
            "sqlite:///example.db",
            "sqlite:///./examples/local_db/.db",
            "sqlite:///",
            "mysql://username:password@localhost:3306/database",
        ],
    )

I activate my env, run eval "$(register-python-argcomplete myapp)" and the suggestions work fine in bash. In zsh however, this does not work correctly and only shows suggestions like: sqlite -- ///example.db:uri string for a database

Is there anything I can do about it? I did not find a way to escape this with some characters.

The problem here seems to be that, zsh suggestion seem to look something like zstyle ':completion:*:*:*:*:descriptions' - where the colon is used to separate the completion from the description..

I have the feeling that this worked yesterday, but I don't know what the cause is

kislyuk commented 7 months ago

Thank you for reporting. Released fix in v3.1.5, please test.

maurerle commented 7 months ago

Works well! Thank you for the quick fix! :tada: