From 14f66bc624f1643256c3412ca02add26bdcc951c Mon Sep 17 00:00:00 2001 From: Harrison Kiang Date: Mon, 22 May 2023 12:01:32 -0500 Subject: [PATCH] remove jq dependency see https://github.com/ohmyzsh/ohmyzsh/pull/8699#issuecomment-1293588083 --- plugins/kubectl/kubectl.plugin.zsh | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 7fedc51eb..b210f073c 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -83,17 +83,9 @@ alias kgseca='kubectl get secret --all-namespaces' alias kdsec='kubectl describe secret' alias kdelsec='kubectl delete secret' alias kdecsec=' -_kdecsec() { - if [ $(jq --version) != "jq-1.6" ]; then - echo "kdecsec requires jq-1.6 to use the base64d format"; - unset -f _kdecsec - return 1 - fi - kubectl get secret "$@" -o json | jq ".data | map_values(. | @base64d )"; - unset -f _kdecsec - return 0 -}; -_kdecsec' +kdecsec_go_template='{{range $k,$v := .data}}{{"### "}}{{$k}}{{"\n"}}{{$v|base64decode}}{{"\n\n"}}{{end}}' +alias kdecsec="kubectl get secret -o go-template='$kdecsec_go_template'" +unset kdecsec_go_template # Deployment management. alias kgd='kubectl get deployment'