Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Completion/Unix/Command/_make: whitespace/indent fixes



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