Unverified Commit 68f80944 authored by Raphaël Pinson's avatar Raphaël Pinson Committed by GitHub
Browse files

kubectl: add wrappers for colorized output in JSON and YAML (#9316)


Co-authored-by: default avatarMarc Cornellà <marc.cornella@live.com>
parent 27857e66
...@@ -106,3 +106,11 @@ plugins=(... kubectl) ...@@ -106,3 +106,11 @@ plugins=(... kubectl)
| kdelss | `kubectl delete statefulset` | Delete the statefulset | | kdelss | `kubectl delete statefulset` | Delete the statefulset |
| ksss | `kubectl scale statefulset` | Scale a statefulset | | ksss | `kubectl scale statefulset` | Scale a statefulset |
| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment | | krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment |
## Wrappers
This plugin provides 3 wrappers to colorize kubectl output in JSON and YAML using various tools (which must be installed):
- `kj`: JSON, colorized with [`jq`](https://stedolan.github.io/jq/).
- `kjx`: JSON, colorized with [`fx`](https://github.com/antonmedv/fx).
- `ky`: YAML, colorized with [`yh`](https://github.com/andreazorzetto/yh).
...@@ -150,3 +150,19 @@ alias kepvc='kubectl edit pvc' ...@@ -150,3 +150,19 @@ alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc' alias kdpvc='kubectl describe pvc'
alias kdelpvc='kubectl delete 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
# Colored YAML output
ky() {
kubectl "$@" -o yaml | yh
}
compdef ky=kubectl
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment