Skip to content

Choice autocomplete incorrect for enums #3015

@berndbohmeier

Description

@berndbohmeier

When using enums, the autocomplete doesn't give a value that works, as it doesn't use the same code to normalize.

Use an enum like

import enum

class MyEnum(enum.Enum):
    foo = "bar"

with

@click.choice(MyEnum)

The accepted value for the argument will be "foo", but the autocompleted value is "MyEnum.foo"

Environment:

  • Python version: 3.13.4
  • Click version: 8.2.1

I think I know how to fix it roughly, so I can open a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions