Giter VIP home page Giter VIP logo

Comments (6)

weibeld avatar weibeld commented on July 17, 2024 4

@imduffy15 yes, you can use complete-alias. The following enables completion for each of the kubectl aliases:

for a in $(sed '/^alias /!d;s/^alias //;s/=.*$//' ~/.kubectl_aliases); do
  complete -F _complete_alias "$a"
done

The _complete_alias function is provided by complete-alias and it can be used to enable completion for every alias in general (as long as the aliased command has completion itself).

complete-alias depends on bash-completion, so you have to install it too.

If you use macOS, it won't work on the built-in version of Bash, because this is Bash version 3.2. You have to install Bash 4.1+ and bash-completion 2+.

from kubectl-aliases.

ahmetb avatar ahmetb commented on July 17, 2024

Sounds like a bash question and not about kubectl-aliases. :) I personally use zsh, too so I don't hit this. I recommend you ask this on https://superuser.com.

from kubectl-aliases.

weibeld avatar weibeld commented on July 17, 2024

It is a Bash issue. I just asked because you mention in your post that kubectl completion keeps working with the aliases. So, in that case, this only holds for Zsh, but not for Bash.

from kubectl-aliases.

imduffy15 avatar imduffy15 commented on July 17, 2024

@weibeld did you have a resolution for this?

from kubectl-aliases.

imduffy15 avatar imduffy15 commented on July 17, 2024

Works perfectly. Thank you @weibeld

@ahmetb Are you open to a PR that places this advice into the readme? :)

from kubectl-aliases.

ahmetb avatar ahmetb commented on July 17, 2024

We can link from the readme, sure.

from kubectl-aliases.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.