From 48100f71172e35e19a50ecea940ad88691d732cb Mon Sep 17 00:00:00 2001 From: Xing Zhou Date: Mon, 22 Aug 2016 20:51:15 +0800 Subject: [PATCH] Fixed two issues of kubectl bosh completion. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch includes the fix of the following issue: • Correct the method invocation from "__kubectl_namespace_flag" to "__kubectl_override_flags" • Support bash completion if "--namespace=xxx" style flags are specified in the kubectl command Fixes #31134 --- pkg/kubectl/cmd/cmd.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/kubectl/cmd/cmd.go b/pkg/kubectl/cmd/cmd.go index 273e59a16e..185f78fc01 100644 --- a/pkg/kubectl/cmd/cmd.go +++ b/pkg/kubectl/cmd/cmd.go @@ -47,7 +47,7 @@ __kubectl_override_flags() for of in "${__kubectl_override_flag_list[@]}"; do case "${w}" in --${of}=*) - eval "${of}=\"--${of}=\${w}\"" + eval "${of}=\"${w}\"" ;; --${of}) two_word_of="${of}" @@ -115,7 +115,7 @@ __kubectl_get_containers() fi local last=${nouns[${len} -1]} local kubectl_out - if kubectl_out=$(kubectl get $(__kubectl_namespace_flag) -o template --template="${template}" pods "${last}" 2>/dev/null); then + if kubectl_out=$(kubectl get $(__kubectl_override_flags) -o template --template="${template}" pods "${last}" 2>/dev/null); then COMPREPLY=( $( compgen -W "${kubectl_out[*]}" -- "$cur" ) ) fi }