* [PATCH] Completion/Unix/Command/_make: whitespace/indent fixes
@ 2017-06-24 20:28 Daniel Hahler
2017-06-25 20:54 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Hahler @ 2017-06-24 20:28 UTC (permalink / raw)
To: zsh-workers
From: Daniel Hahler <git@thequod.de>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Completion/Unix/Command/_make: whitespace/indent fixes
2017-06-24 20:28 [PATCH] Completion/Unix/Command/_make: whitespace/indent fixes Daniel Hahler
@ 2017-06-25 20:54 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2017-06-25 20:54 UTC (permalink / raw)
To: zsh-workers
On Jun 24, 10:28pm, Daniel Hahler wrote:
} Subject: [PATCH] Completion/Unix/Command/_make: whitespace/indent fixes
Is this in preparation for some actual functionality change that would
otherwise be conflated with the whitespace changes?
Some of this, for example --
} - while read input
} - do
} + while read input; do
-- and --
} - for (( index=0; index < $#@; index++ ))
} - do
} + for (( index=0; index < $#@; index++ )); do
} if [[ $@[index] == -C ]]
} then
} file=${~@[index+1]} 2>/dev/null
-- seems unnecesary, especially give that you did NOT change any of the
if-newline-then-newline into if-semicolon-then-newline.
Aside from that, it does look better with the deeper case-body indent.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-25 20:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-24 20:28 [PATCH] Completion/Unix/Command/_make: whitespace/indent fixes Daniel Hahler
2017-06-25 20:54 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).