Skip to content

completion for --state flag of gh pr list/gh issue list #3863

@autopp

Description

@autopp

Describe the feature or problem you’d like to solve

I want completions for --state flag of gh pr list/gh issue list command.

Expected behavior is:

$ gh pr list --state [TAB]
all  closed  merged  open

It prevent wrong input such as gh pr list --state opened, gh issue list --state close, etc...
(I wasted many time by these typos)

Proposed solution

We can use cobra's completion support (RegisterFlagCompletionFunc) in the same way as #3628.

I confirmed in my branch which works good on zsh.

state-flag.mov

Diff is here: 936d6e1...autopp:complete-state-flag
If this approach is okey, I'll submit it as a PR

Additional context

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions