1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-23 02:10:26 +08:00

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

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
This commit is contained in:
Raphaël Pinson 2020-10-08 19:18:43 +02:00 committed by GitHub
parent 27857e66d0
commit 68f809448a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -106,3 +106,11 @@ plugins=(... kubectl)
| kdelss | `kubectl delete statefulset` | Delete the statefulset |
| ksss | `kubectl scale statefulset` | Scale a statefulset |
| 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).

View File

@ -150,3 +150,19 @@ 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
# Colored YAML output
ky() {
kubectl "$@" -o yaml | yh
}
compdef ky=kubectl