Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
5b717ab3
Unverified
Commit
5b717ab3
authored
Oct 15, 2020
by
IsThisTheMatrix
Committed by
GitHub
Oct 16, 2020
Browse files
kubectl: verify kubectl is installed before running compdef (#9346)
parent
53cbd658
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/kubectl/kubectl.plugin.zsh
View file @
5b717ab3
...
...
@@ -150,19 +150,13 @@ alias kepvc='kubectl edit pvc'
alias
kdpvc
=
'kubectl describe pvc'
alias
kdelpvc
=
'kubectl delete pvc'
# Colored JSON output
kj
()
{
kubectl
"
$@
"
-o
json | jq
}
compdef
kj
=
kubectl
kjx
()
{
kubectl
"
$@
"
-o
json | fx
}
compdef
kjx
=
kubectl
# Only run if the user actually has kubectl installed
if
((
$+
commands[kubectl]
))
;
then
kj
()
{
kubectl
"
$@
"
-o
json | jq
;
}
kjx
()
{
kubectl
"
$@
"
-o
json | fx
;
}
ky
()
{
kubectl
"
$@
"
-o
yaml | yh
;
}
# Colored YAML output
ky
()
{
kubectl
"
$@
"
-o
yaml | yh
}
compdef
ky
=
kubectl
compdef
kj
=
kubectl
compdef
kjx
=
kubectl
compdef
ky
=
kubectl
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment