Merge pull request #89479 from knight42/fix/zsh-completion-file-flag
fix(kubectl): remove trailing space when completing file path Kubernetes-commit: c32b93aa2bc20aab9249df02ac50279b48847edc
This commit is contained in:
commit
33fb6c9168
|
@ -572,11 +572,11 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api",
|
||||
"Rev": "5778e4f3d00d"
|
||||
"Rev": "ee3d7cc2ccd8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery",
|
||||
"Rev": "e002472249f8"
|
||||
"Rev": "06deae5c9c2c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/cli-runtime",
|
||||
|
|
8
go.mod
8
go.mod
|
@ -34,8 +34,8 @@ require (
|
|||
github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1 // indirect
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd
|
||||
gopkg.in/yaml.v2 v2.2.8
|
||||
k8s.io/api v0.0.0-20200410021914-5778e4f3d00d
|
||||
k8s.io/apimachinery v0.0.0-20200410061239-e002472249f8
|
||||
k8s.io/api v0.0.0-20200413061331-ee3d7cc2ccd8
|
||||
k8s.io/apimachinery v0.0.0-20200413181316-06deae5c9c2c
|
||||
k8s.io/cli-runtime v0.0.0-20200410032008-46db67004b57
|
||||
k8s.io/client-go v0.0.0-20200410182515-1be5940d0dd4
|
||||
k8s.io/component-base v0.0.0-20200410024425-8582c5203e4b
|
||||
|
@ -51,8 +51,8 @@ require (
|
|||
replace (
|
||||
golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
|
||||
golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
|
||||
k8s.io/api => k8s.io/api v0.0.0-20200410021914-5778e4f3d00d
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200410061239-e002472249f8
|
||||
k8s.io/api => k8s.io/api v0.0.0-20200413061331-ee3d7cc2ccd8
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200413181316-06deae5c9c2c
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20200410032008-46db67004b57
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20200410182515-1be5940d0dd4
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20200410020940-986da3785c57
|
||||
|
|
4
go.sum
4
go.sum
|
@ -325,8 +325,8 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81
|
|||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
k8s.io/api v0.0.0-20200410021914-5778e4f3d00d/go.mod h1:kNZHsfUjF+wX4CfMBMSHs4FliofoB7PN0ILSMBbxyYc=
|
||||
k8s.io/apimachinery v0.0.0-20200410061239-e002472249f8/go.mod h1:imoz42hIYwpLTRWXU8pdJ9IE8DbxUsnU9lyVN8Y1SNo=
|
||||
k8s.io/api v0.0.0-20200413061331-ee3d7cc2ccd8/go.mod h1:MfG8IGkMLGJgJxPRRWC7k30CzNiPQQfGmolWWZjyzr4=
|
||||
k8s.io/apimachinery v0.0.0-20200413181316-06deae5c9c2c/go.mod h1:imoz42hIYwpLTRWXU8pdJ9IE8DbxUsnU9lyVN8Y1SNo=
|
||||
k8s.io/cli-runtime v0.0.0-20200410032008-46db67004b57/go.mod h1:tBOIBnD9aGgswoeK+7rN3kVzg/V058I/BQYITsFKjUQ=
|
||||
k8s.io/client-go v0.0.0-20200410182515-1be5940d0dd4/go.mod h1:zXkQ9D1RJ94zQF7I0XpAPErYL57rqGlBnNP7CW3F2Uo=
|
||||
k8s.io/code-generator v0.0.0-20200410020940-986da3785c57/go.mod h1:921XK/cUtrTpn/F0nAhNaFjo8I7Kue1BIEtdxsYFt9I=
|
||||
|
|
|
@ -223,49 +223,9 @@ __kubectl_get_comp_words_by_ref() {
|
|||
}
|
||||
|
||||
__kubectl_filedir() {
|
||||
local RET OLD_IFS w qw
|
||||
|
||||
__kubectl_debug "_filedir $@ cur=$cur"
|
||||
if [[ "$1" = \~* ]]; then
|
||||
# somehow does not work. Maybe, zsh does not call this at all
|
||||
eval echo "$1"
|
||||
return 0
|
||||
fi
|
||||
|
||||
OLD_IFS="$IFS"
|
||||
IFS=$'\n'
|
||||
if [ "$1" = "-d" ]; then
|
||||
shift
|
||||
RET=( $(compgen -d) )
|
||||
else
|
||||
RET=( $(compgen -f) )
|
||||
fi
|
||||
IFS="$OLD_IFS"
|
||||
|
||||
IFS="," __kubectl_debug "RET=${RET[@]} len=${#RET[@]}"
|
||||
|
||||
for w in ${RET[@]}; do
|
||||
if [[ ! "${w}" = "${cur}"* ]]; then
|
||||
continue
|
||||
fi
|
||||
if eval "[[ \"\${w}\" = *.$1 || -d \"\${w}\" ]]"; then
|
||||
qw="$(__kubectl_quote "${w}")"
|
||||
if [ -d "${w}" ]; then
|
||||
COMPREPLY+=("${qw}/")
|
||||
else
|
||||
COMPREPLY+=("${qw}")
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
__kubectl_quote() {
|
||||
if [[ $1 == \'* || $1 == \"* ]]; then
|
||||
# Leave out first character
|
||||
printf %q "${1:1}"
|
||||
else
|
||||
printf %q "$1"
|
||||
fi
|
||||
# Don't need to do anything here.
|
||||
# Otherwise we will get trailing space without "compopt -o nospace"
|
||||
true
|
||||
}
|
||||
|
||||
autoload -U +X bashcompinit && bashcompinit
|
||||
|
|
Loading…
Reference in New Issue