Skip to content

Add kubectl completions #5516

Closed
Closed

Description

@xordspar0

It would be great if fish had completions for kubectl subcommands and resources, but is it really possible? Certainly we could do subcommands, but the resources vary from server to server.

This is similar to Gradle tasks. It looks like Gradle completions are done by running gradle tasks and parsing the output. We could do that with kubectl get, but doesn't that mean going over the network to the server and asking what resources it allows?

Alternatively, we could just have a static list of common resources.

Finally, kubectl has a built-in feature to generate completions for bash and zsh. Maybe support for fish should be added at that end instead. This would either require adding fish support to the cobra library (with would be great) or building a custom completion generator into kubectl itself.

Any other ideas? Whatever we decide, I'm eager to do the work for this and submit a PR.

Activity

  1. xordspar0 commented on Jan 11, 2019

    @xordspar0
    Author

    I just found that there's an open PR in cobra that would allow kubectl to generate its own completions: spf13/cobra#754

    Maybe it's better to let kubectl take care of this on its own? I'm not sure what fish's preference is for where completions live.

  2. zanchey commented on Jan 12, 2019

    @zanchey
    Member

    Definitely preferred upstream. That way they stay in sync with the features offered.

  3. evanlucas commented on Jan 20, 2019

    @evanlucas

    @xordspar0 I maintain https://github.com/evanlucas/fish-kubectl-completions which works well for me. The goal is to eventually get it upstreamed into kubectl itself, but that is still a ways off.

  4. zanchey commented on Jan 26, 2019

    @zanchey
    Member

    Let's leave this to the upstream project.

  5. locked as resolved and limited conversation to collaborators on Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions