From 011ee485aa399e58673242a9baffb107d96755db Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Tue, 20 Jun 2023 00:22:05 +0200 Subject: [PATCH] fix: Set the current ns if one is not set --- README.md | 1 + completions/_kubers | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b156b1..226d7fd 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,4 @@ Examples: ``` $ kubers -n $SECRET_NAME ``` + \ No newline at end of file diff --git a/completions/_kubers b/completions/_kubers index a162b72..2cf1a89 100644 --- a/completions/_kubers +++ b/completions/_kubers @@ -20,6 +20,7 @@ funcion _kubers() { _values compadd $(kubectl get namespaces --no-headers -o custom-columns=":metadata.name") ;; secret) + NAMESPACE=$(kubectl config view --minify -o jsonpath='{..namespace}') for (( i = 1; i <= $#words - 1; i++ )); do if [[ $words[$i] == -n || $words[$i] == --namespace ]]; then NAMESPACE=$words[$((i+1))] @@ -40,4 +41,4 @@ funcion _kubers() { _values compadd $(for KEY in $(kubectl --namespace $NAMESPACE get secret $SECRET_NAME -o yaml | yq '.data | keys' | sed -e "s/- //"); do echo $KEY; done) ;; esac -} \ No newline at end of file +}