Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zsh completion still misbehaving in the presence of : #2703

Open
Julian opened this issue Apr 4, 2024 · 0 comments
Open

zsh completion still misbehaving in the presence of : #2703

Julian opened this issue Apr 4, 2024 · 0 comments

Comments

@Julian
Copy link
Contributor

Julian commented Apr 4, 2024

Given foo containing:

#!/usr/bin/env python3
from click.shell_completion import CompletionItem
import click

class Foo(click.ParamType):
    def convert(self, value, param, ctx):
        return value

    def shell_complete(self, ctx, param, incomplete):
        return [
            CompletionItem(value=value, help="adsf") for value in 
            ["baz:quux", "spam:eggs"]
        ]

@click.command()
@click.argument("foo", type=Foo())
def main(foo):
    print(foo)

and running shell completion generation, followed by attempting to complete the command (indicated via <Tab>, produces:

⊙  PATH=$PWD:/Users/Julian/.local/share/virtualenvs/bowtie/bin/:$PATH
⊙  eval "$(_FOO_COMPLETE=zsh_source ./foo)"                                                                                                                                                                                                                                                                         
⊙  foo <Tab>
baz   -- quux:adsf
spam  -- eggs:adsf

rather than the expected:

baz:quux   -- adsf
spam:eggs -- adsf

This seems to be a regression on #1812.

The fix mentioned there (of "fake escaping" the colons via .replace(":", "\\:") seems to work.

Environment:

  • Python version:
⊙  python --version                                                                                                                                                                                                                                                                                                 julian@Airm
Python 3.11.9
  • Click version:
⊙  python -m pip show click                                                                                                                                                                                                                                                                                         julian@Airm
Name: click
Version: 8.1.7
Summary: Composable command line interface toolkit
Home-page: https://palletsprojects.com/p/click/
Author: 
Author-email: 
License: BSD-3-Clause
Location: /Users/julian/.dotfiles/.local/share/virtualenvs/bowtie/lib/python3.11/site-packages
Requires: 
Required-by: rich-click, trogon, virtue
@Julian Julian changed the title zsh completion still misbehaving in the presence of : zsh completion still misbehaving in the presence of : Apr 4, 2024
Julian added a commit to bowtie-json-schema/bowtie that referenced this issue Apr 4, 2024
We here apparently hit a click regression, which I've filed as
pallets/click#2703.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant