feat: kxn and kns aliases

This commit is contained in:
AngeD 2023-03-25 08:52:34 +01:00
parent 4fc13d3504
commit 89d4708de5
8 changed files with 9 additions and 8 deletions

View file

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
function kctx() {
function kxn() {
1="$(echo - "$1" | tr -c '[:alnum:]-_' '[ *]')"
local ctx="$(echo - "$1" | awk '{print $1}')"
local ns="${2-$(echo - "$1" | awk '{print $2}')}"
@ -20,6 +20,7 @@ function kctx() {
kubectx ${ctx:l}
[ -n "$ns" ] && kubens "${ns:l}"
}
compdef _kubectx kxn
alias kns='kubens'
alias k='kubectl'

View file

@ -1176,7 +1176,7 @@
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
# Show kubecontext only when the command you are typing invokes one of these tools.
# Tip: Remove the next line to always show kubecontext.
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern|kubeseal|skaffold'
typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|kxn|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern|kubeseal|skaffold'
# Kubernetes context classes for the purpose of using different colors, icons and expansions with
# different contexts.

@ -1 +1 @@
Subproject commit 2aa16c54314f175e4f34fdd7fa1bdb03f1797c6a
Subproject commit cb9788b12a1fade6be631ad905928f9a5f7eb03f

@ -1 +1 @@
Subproject commit 72732a224e886933df6b64a49ec6f5e94c884612
Subproject commit c08b925d282e35ea7bd9a8f4c29de2ece0debb49