Giter VIP home page Giter VIP logo

rverma-jm / zsh-kubectl-completion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nnao45/zsh-kubectl-completion

0.0 1.0 0.0 205 KB

Rich zsh completion for the kubectl command.

Home Page: https://medium.com/@n4sekai5y/kubectl-completion-zsh%E3%82%92%E8%BB%8A%E8%BC%AA%E3%81%AE%E5%86%8D%E7%99%BA%E6%98%8E%E3%81%97%E3%81%9F-da6c5345263f

License: GNU General Public License v3.0

Shell 7.10% Makefile 92.90%

zsh-kubectl-completion's Introduction

v1.13 v0.1.12

nnao45/zsh-kubectl-completion

Rich zsh completion for the kubectl command.

asciicast

Version

kubectl zsh-kubectl-completion
v1.12.2 v0.1.6
v0.13.5 v0.1.7
v0.13.5 v0.1.8
v0.13.5 v0.1.9
v0.13.5 v0.1.10
v0.13.5 v0.1.11
v0.13.5 v0.1.12

Install

zplug

write this in your .zshrc.

zplug "nnao45/zsh-kubectl-completion"

Prezto

$ curl -fLo ~/.zprezto/modules/completion/external/src/_kubectl \
  https://raw.githubusercontent.com/nnao45/zsh-kubectl-completion/master/_kubectl 
$ exec zsh

Manual

for example, you set ~/.zsh/completion,

$ curl -fLo ~/.zsh/completion_kubectl \ 
  https://raw.githubusercontent.com/nnao45/zsh-kubectl-completion/master/_kubectl
$ exec zsh

Resource Filitling

This completion of kubectl has several flags corresponding to context override, for example, specify the namespace of the operation target --namespace flag should be set before entering resource name such as pod name So we will use the target namespace resource as a candidate for completion. The options supported for override are as follows.

  • --kubeconfig
  • --cluster
  • --user
  • --context
  • --namespace
  • --server

And...

If you want to complete list is "non grouped", you set additional attr.
(I don't like grouped complete list when same word comment.)

By default,

$ kubectl describe namespaces <TAB>
namespace
kkk  jjj  iii  hhh  ggg  fff  eee  ddd  ccc  bbb  aaa
vvv  uuu  ttt  sss  rrr  qqq  ppp  ooo  nnn  mmm  lll
zzz  yyy  xxx  www                                     -- Active

Add this setting in your .zshrc,

zstyle ':completion:*:*:kubectl:*' list-grouped false

Show this😍

$ kubectl describe namespaces <TAB>
namespace
aaa  -- Active
bbb  -- Active
ccc  -- Active
ddd  -- Active
eee  -- Active
fff  -- Active
ggg  -- Active
hhh  -- Active
iii  -- Active
jjj  -- Active
kkk  -- Active
lll  -- Active
mmm  -- Active
nnn  -- Active
ooo  -- Active
ppp  -- Active
qqq  -- Active
rrr  -- Active
sss  -- Active
ttt  -- Active
uuu  -- Active
vvv  -- Active
www  -- Active
xxx  -- Active
yyy  -- Active
zzz  -- Active

zsh-kubectl-completion's People

Contributors

nnao45 avatar

Watchers

James Cloos avatar

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.