convert h to original helm

This commit is contained in:
hophacker 2020-02-19 12:58:35 +08:00
parent 9c91b1b769
commit af089473bd
2 changed files with 18 additions and 13 deletions

View File

@ -324,4 +324,3 @@ endfunction
" set paste " set paste
nnoremap <localleader>tp :call TogglePaste()<cr> nnoremap <localleader>tp :call TogglePaste()<cr>
nnoremap <localleader>tt :call ToggleRspecTest()<cr> nnoremap <localleader>tt :call ToggleRspecTest()<cr>

View File

@ -240,8 +240,7 @@ function kubectl() {
case $1 in case $1 in
-c) -c)
CONTEXT="$2" CONTEXT="$2"
shift shift; shift
shift
;; ;;
--context=*) --context=*)
CONTEXT="${i#*=}" CONTEXT="${i#*=}"
@ -263,8 +262,7 @@ function stern {
case $1 in case $1 in
-c) -c)
CONTEXT="$2" CONTEXT="$2"
shift shift; shift
shift
;; ;;
--context=*) --context=*)
CONTEXT="${i#*=}" CONTEXT="${i#*=}"
@ -279,15 +277,23 @@ function stern {
echo "stern $finalopts --kubeconfig=$HOME/.kube/${CONTEXT}_config" echo "stern $finalopts --kubeconfig=$HOME/.kube/${CONTEXT}_config"
command stern $finalopts -t --since 10m --kubeconfig=$HOME/.kube/${CONTEXT}_config command stern $finalopts -t --since 10m --kubeconfig=$HOME/.kube/${CONTEXT}_config
} }
alias kg="k -c qcloud" function helm() {
function h() {
CONTEXT=gcloud CONTEXT=gcloud
while getopts ":c:" opt; do finalopts=()
case ${opt} in while [[ $@ != "" ]] do
c) case $1 in
CONTEXT=$OPTARG -c)
CONTEXT="$2"
shift; shift shift; shift
;; ;;
--context=*)
CONTEXT="${i#*=}"
shift
;;
*)
finalopts+=($1)
shift
;;
esac esac
done done
TLS="" TLS=""
@ -295,9 +301,9 @@ function h() {
gcloud) gcloud)
TLS="--tls" TLS="--tls"
esac esac
helm $* $TLS --kubeconfig $HOME/.kube/${CONTEXT}_config echo "helm $finalopts $TLS --kubeconfig=$HOME/.kube/${CONTEXT}_config"
command helm $finalopts $TLS --kubeconfig=$HOME/.kube/${CONTEXT}_config
} }
alias hg="h -c qcloud"
function kexec { function kexec {
RAN=false RAN=false
CONTEXT=gcloud CONTEXT=gcloud