Skip to content

Bash complete fails for click.Choice() arguments #535

@travis-bear

Description

@travis-bear

Arguments of type 'click.Choice' are properly constrained on invocation, but do not show up in bash tab completion.

dws.py:

...

SETTINGS = [
    "auto_start",
    "disk_size",
    "environment"
]

@click.group()
def cli():
    pass


@cli.command()
@click.argument('setting', type=click.Choice(SETTINGS), nargs=1)
@click.argument('value', nargs=1)
def set(setting, value):
    '''
    Persists a named setting.  Supported settings:
    ["environment", "add_to_chef"]
    '''
    click.echo("Persisting a setting: %s=%s" % (setting, value))

...

dws <tab> <tab> reveals the set function as expected, but not the allowable values from the SETTINGS list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions