diff options
author | Oliver Kiddle <okiddle@yahoo.co.uk> | 2020-01-03 23:01:00 +0100 |
---|---|---|
committer | Oliver Kiddle <okiddle@yahoo.co.uk> | 2020-01-03 23:01:00 +0100 |
commit | e6c5482dd8546c62704d14492f302353b16d8245 (patch) | |
tree | 5fdaebf9c646d9581bf077cbdbac18313469f943 /Completion/Unix/Command | |
parent | 759daf2362c80c1840abbdea48db15450d8b44d0 (diff) | |
download | zsh-e6c5482dd8546c62704d14492f302353b16d8245.tar.gz zsh-e6c5482dd8546c62704d14492f302353b16d8245.tar.xz zsh-e6c5482dd8546c62704d14492f302353b16d8245.zip |
45196: fix completion after make -C, allowing for -C being used multiple times
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r-- | Completion/Unix/Command/_make | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index 06971f07a..21ed56184 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -120,12 +120,12 @@ _make-parseMakefile () { _make() { - local prev="$words[CURRENT-1]" file expl tmp is_gnu incl match basedir + local prev="$words[CURRENT-1]" file expl tmp is_gnu incl match basedir nul=$'\0' local context state state_descr line local -a option_specs local -A VARIABLES VAR_ARGS opt_args local -aU TARGETS keys - local ret=1 + local -i cdir=-1 ret=1 # VAR=VAL on the current command line for tmp in $words; do @@ -142,7 +142,7 @@ _make() { incl="(-|)include" option_specs=( '(-B --always-make)'{-B,--always-make}'[unconditionally make all targets]' - '*'{-C,--directory=}'[change directory first]:change to directory:->dir' + '*'{-C,--directory=}'[change directory first]:change to directory:->cdir' '-d[print lots of debug information]' '--debug=-[print various types of debug information]:debug options:->debug' '(-e --environment-overrides)'{-e,--environment-overrides}'[environment variables override makefiles]' @@ -177,7 +177,7 @@ _make() { # Basic make options only. incl=.include option_specs=( - '-C[change directory first]:directory:->dir' + '-C[change directory first]:directory:->cdir' '-I[include directory for makefiles]:directory:->dir' '-f[specify makefile]:makefile:->file' '-o[specify file not to remake]:file not to remake:->file' @@ -188,11 +188,12 @@ _make() { _arguments -s $option_specs \ '*:make target:->target' && ret=0 - basedir=${(Q)~opt_args[-C]:-${opt_args[--directory]}} - VAR_ARGS[CURDIR]="${basedir:=$PWD}" + [[ $state = cdir ]] && cdir=-2 + basedir=${(j./.)${${~"${(@s.:.):-$PWD:${(Q)${opt_args[-C]:-$opt_args[--directory]}//\\:/$nul}}"}[(R)/*,cdir]}//$nul/:} + VAR_ARGS[CURDIR]="${basedir}" case $state in - (dir) + (*dir) _description directories expl "$state_descr" _files "$expl[@]" -W $basedir -/ && ret=0 ;; |