Merge pull request #31135 from xingzhou/bash_completion_bug

Automatic merge from submit-queue

Fixed two issues of kubectl bash completion.

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
pull/6/head
Kubernetes Submit Queue 2016-08-24 23:43:20 -07:00 committed by GitHub
commit bdeeb9db90
1 changed files with 2 additions and 2 deletions

View File

@ -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
}