Skip to content

Autocomplete should not complete subcommands while expecting required argument or option #790

@Gig77

Description

@Gig77

Suppose my cli has two subcommands, sub1 and sub2. sub1 has an option -o that requires a value. This option has an autocomplete function assigned to it.

When I enter

$ cli sub1 -o <tab><tab>

autocomplete not only suggests my allowed values for -o, but also sub2. However, since an option value is required after -o, sub2 is an invalid suggestion at this point.

The same happens with required arguments.

Is there a possibility to suppress autocompletion of subcommands while still in the context of required arguments or options?

Python version is Python 3.5.2 :: Anaconda 4.2.0 (64-bit) and Click version is 7.0-dev.

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