diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 8e6a2aa..d2d2270 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -388,19 +388,26 @@ function kexec { fi } -function k_logs { - CONTEXT=gcloud - while getopts ":c:p:" opt; do - case "${opt}" in - c) - CONTEXT=$OPTARG +function klogs { + KCONTEXT=${KCONTEXT:-gcloud} + finalopts=() + while [[ $@ != "" ]] do + case $1 in + -c) + KCONTEXT="$2" + shift; shift ;; - p) - PROJECT=$OPTARG + --context=*) + KCONTEXT="${i#*=}" + shift + ;; + -p) + PROJECT="$2" + shift; shift ;; *) - echo "Usage: cmd [-h]" - return + finalopts+=($1) + shift ;; esac done