From 6fc17bcfe5cff866b55636a1d3f600730171d2d7 Mon Sep 17 00:00:00 2001 From: yage Date: Thu, 5 Oct 2023 14:36:40 -0600 Subject: [PATCH] v3.6.2 ===================================================================== --- Bug fixes ---------------------------- - fixed some bugs with kubectl plugin preloading and argument processing --- plugins/kubectl/driver/kubectl.driver.zsh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/kubectl/driver/kubectl.driver.zsh b/plugins/kubectl/driver/kubectl.driver.zsh index 28de325..9392c1f 100644 --- a/plugins/kubectl/driver/kubectl.driver.zsh +++ b/plugins/kubectl/driver/kubectl.driver.zsh @@ -1,5 +1,6 @@ [[ $SCWRYPTS_KUBECTL_DRIVER_READY -eq 1 ]] && return 0 +unalias k h k() { _SCWRYPTS_KUBECTL_DRIVER kubectl $@; } h() { _SCWRYPTS_KUBECTL_DRIVER helm $@; } @@ -79,6 +80,8 @@ _SCWRYPTS_KUBECTL_DRIVER() { local HELP=0 local ERRORS=0 + local COMMAND_SWITCH_CASE="@($(echo $CUSTOM_COMMANDS | sed 's/ /|/g'))" + [ ! $SUBSESSION ] && local SUBSESSION=0 [[ $1 =~ ^[0-9]$ ]] && SUBSESSION=$1 && shift 1 @@ -110,7 +113,18 @@ _SCWRYPTS_KUBECTL_DRIVER() { -- ) shift 1; break ;; - * ) USER_ARGS+=($1) ;; + * ) + [ ! $CUSTOM_COMMAND ] && { + for C in ${CUSTOM_COMMANDS[@]} + do + [[ $1 =~ ^$C$ ]] && { + SCWRYPTS_KUBECTL_CUSTOM_COMMAND_PARSE__$1 ${@:2} + break + } + done + } + USER_ARGS+=($1) + ;; esac shift 1 done