2c08d2b8423d6fc38d4d6e3be3aaebc3522b1555
- Author
- Carlo Sala <carlosalag@protonmail.com>
- Committer
- Carlo Sala <carlosalag@protonmail.com>
- Date
Message
fix(kubectl): load completion properly in functions
Closes #12427
Diff
1diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
2index 0dd4e691a7ff266291b3d87e706d6698dbd731fa..a96e409c61db3dd1a4e9b11ee011cd7a9cce89e6 100644
3--- a/plugins/kubectl/kubectl.plugin.zsh
4+++ b/plugins/kubectl/kubectl.plugin.zsh
5@@ -180,13 +180,11 @@ alias kej='kubectl edit job'
6 alias kdj='kubectl describe job'
7 alias kdelj='kubectl delete job'
8
9-# Only run if the user actually has kubectl installed
10-if (( ${+_comps[kubectl]} )); then
11- function kj() { kubectl "$@" -o json | jq; }
12- function kjx() { kubectl "$@" -o json | fx; }
13- function ky() { kubectl "$@" -o yaml | yh; }
14-
15- compdef kj=kubectl
16- compdef kjx=kubectl
17- compdef ky=kubectl
18+function kj() { kubectl "$@" -o json | jq; }
19+function kjx() { kubectl "$@" -o json | fx; }
20+function ky() { kubectl "$@" -o yaml | yh; }
21+if (( ${+functions[compdef]} )); then
22+ compdef _kubectl kj
23+ compdef _kubectl kjx
24+ compdef _kubectl ky
25 fi