summaryrefslogtreecommitdiff
path: root/plugins/kubectl
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kubectl')
-rw-r--r--plugins/kubectl/README.md8
-rw-r--r--plugins/kubectl/kubectl.plugin.zsh16
2 files changed, 24 insertions, 0 deletions
diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
index ee05a8af1..84f5f8d89 100644
--- a/plugins/kubectl/README.md
+++ b/plugins/kubectl/README.md
@@ -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).
diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
index 647d029c1..6292a0b2f 100644
--- a/plugins/kubectl/kubectl.plugin.zsh
+++ b/plugins/kubectl/kubectl.plugin.zsh
@@ -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