mirror of https://github.com/k3s-io/k3s
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 #31134pull/6/head
commit
bdeeb9db90
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue