Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Completion/Unix/Command/_make: whitespace/indent fixes
- X-seq: zsh-workers 41358
- From: Daniel Hahler <genml+zsh-workers@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Completion/Unix/Command/_make: whitespace/indent fixes
- Date: Sat, 24 Jun 2017 22:28:34 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= x-mailer:message-id:date:date:subject:subject:from:from:received :received:received; s=postfix2; t=1498336117; bh=a0Txj4/FP/lJZne Mb5GAmvtIbIrW9/Z8xksb53E+P0M=; b=SUr1FKf7ZOCe2GNrw3JIfawN21pj7Bg mdA0WH5E3x6tkev3a7I1+ieeVaz97Mi+axvEQF963fjadr8vb0/vfU+1tAyiwrqj N51KtHi6PtmBCoDYbObsL0mQkTcTifwpkkmrP5TIY1dV6HA7utf0tqaEGueVMILj epzkeLn3gAoM=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
From: Daniel Hahler <git@xxxxxxxxxx>
---
Completion/Unix/Command/_make | 135 ++++++++++++++++++++----------------------
1 file changed, 64 insertions(+), 71 deletions(-)
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index a2ee9ecac..274d296df 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -71,8 +71,7 @@ _make-expandVars() {
_make-parseMakefile () {
local input var val target dep TAB=$'\t' dir=$1 tmp IFS=
- while read input
- do
+ while read input; do
case "$input " in
# VARIABLE = value OR VARIABLE ?= value
([[:alnum:]][[:alnum:]_]#[" "$TAB]#(\?|)=*)
@@ -125,8 +124,7 @@ _make-parseMakefile () {
_make-findBasedir () {
local file index basedir
basedir=$PWD
- for (( index=0; index < $#@; index++ ))
- do
+ for (( index=0; index < $#@; index++ )); do
if [[ $@[index] == -C ]]
then
file=${~@[index+1]} 2>/dev/null
@@ -149,7 +147,6 @@ _make-findBasedir () {
}
_make() {
-
local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl match
local context state state_descr line
local -a option_specs
@@ -219,83 +216,79 @@ _make() {
case $state in
(dir)
- _description directories expl "$state_descr"
- _files "$expl[@]" -W ${(q)$(_make-findBasedir ${words[1,CURRENT-1]})} -/ && ret=0
- ;;
+ _description directories expl "$state_descr"
+ _files "$expl[@]" -W ${(q)$(_make-findBasedir ${words[1,CURRENT-1]})} -/ && ret=0
+ ;;
(file)
- _description files expl "$state_descr"
- _files "$expl[@]" -W ${(q)$(_make-findBasedir $words)} && ret=0
- ;;
+ _description files expl "$state_descr"
+ _files "$expl[@]" -W ${(q)$(_make-findBasedir $words)} && ret=0
+ ;;
(debug)
- _values -s , 'debug options' \
- '(b v i j m)a[all debugging output]' \
- 'b[basic debugging output]' \
- '(b)v[one level above basic]' \
- '(b)i[describe implicit rule searches (implies b)]' \
- 'j[show details on invocation of subcommands]' \
- 'm[enable debugging while remaking makefiles]' && ret=0
- ;;
+ _values -s , 'debug options' \
+ '(b v i j m)a[all debugging output]' \
+ 'b[basic debugging output]' \
+ '(b)v[one level above basic]' \
+ '(b)i[describe implicit rule searches (implies b)]' \
+ 'j[show details on invocation of subcommands]' \
+ 'm[enable debugging while remaking makefiles]' && ret=0
+ ;;
(target)
- file=${(v)opt_args[(I)(-f|--file|--makefile)]}
- if [[ -n $file ]]
- then
- [[ $file == [^/]* ]] && file=${(q)$(_make-findBasedir $words)}/$file
- [[ -r $file ]] || file=
- else
- local basedir
- basedir=${$(_make-findBasedir $words)}
- if [[ $is_gnu == gnu && -r $basedir/GNUmakefile ]]
- then
- file=$basedir/GNUmakefile
- elif [[ -r $basedir/makefile ]]
- then
- file=$basedir/makefile
- elif [[ -r $basedir/Makefile ]]
- then
- file=$basedir/Makefile
+ file=${(v)opt_args[(I)(-f|--file|--makefile)]}
+ if [[ -n $file ]]; then
+ [[ $file == [^/]* ]] && file=${(q)$(_make-findBasedir $words)}/$file
+ [[ -r $file ]] || file=
else
- file=''
+ local basedir
+ basedir=${$(_make-findBasedir $words)}
+ if [[ $is_gnu == gnu && -r $basedir/GNUmakefile ]]
+ then
+ file=$basedir/GNUmakefile
+ elif [[ -r $basedir/makefile ]]
+ then
+ file=$basedir/makefile
+ elif [[ -r $basedir/Makefile ]]
+ then
+ file=$basedir/Makefile
+ else
+ file=''
+ fi
fi
- fi
- if [[ -n "$file" ]]
- then
- if [[ $is_gnu == gnu ]]
- then
- if zstyle -t ":completion:${curcontext}:targets" call-command; then
- _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
- else
- _make-parseMakefile $PWD < $file
- fi
- else
- if [[ $OSTYPE == (freebsd|dragonfly|netbsd)* || /$words[1] == */bmake* ]]; then
- TARGETS+=(${=${(f)"$(_call_program targets "$words[1]" -s -f "$file" -V.ALLTARGETS 2> /dev/null)"}})
- _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null)
- else
- _make-parseMakefile $PWD < $file
- fi
+ if [[ -n "$file" ]]; then
+ if [[ $is_gnu == gnu ]]; then
+ if zstyle -t ":completion:${curcontext}:targets" call-command; then
+ _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
+ else
+ _make-parseMakefile $PWD < $file
+ fi
+ else
+ if [[ $OSTYPE == (freebsd|dragonfly|netbsd)* || /$words[1] == */bmake* ]]; then
+ TARGETS+=(${=${(f)"$(_call_program targets "$words[1]" -s -f "$file" -V.ALLTARGETS 2> /dev/null)"}})
+ _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null)
+ else
+ _make-parseMakefile $PWD < $file
+ fi
+ fi
fi
- fi
- if [[ $PREFIX == *'='* ]]
- then
- # Complete make variable as if shell variable
- compstate[parameter]="${PREFIX%%\=*}"
- compset -P 1 '*='
- _value "$@" && ret=0
- else
- _tags targets variables
- while _tags
- do
- _requested targets expl 'make targets' \
- compadd -Q -- $TARGETS && ret=0
- _requested variables expl 'make variables' \
- compadd -S '=' -F keys -- ${(k)VARIABLES} && ret=0
- done
- fi
+ if [[ $PREFIX == *'='* ]]; then
+ # Complete make variable as if shell variable
+ compstate[parameter]="${PREFIX%%\=*}"
+ compset -P 1 '*='
+ _value "$@" && ret=0
+ else
+ _tags targets variables
+ while _tags
+ do
+ _requested targets expl 'make targets' \
+ compadd -Q -- $TARGETS && ret=0
+ _requested variables expl 'make variables' \
+ compadd -S '=' -F keys -- ${(k)VARIABLES} && ret=0
+ done
+ fi
esac
return ret
--
2.13.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author