changeset 1684:cf930b2452d3

Cleanup of spacing in bash_completion
author Thomas Arendsen Hein <thomas@intevation.de>
date Thu, 02 Feb 2006 08:16:17 +0100
parents 063e04831a09
children 60c3a55c61b8
files contrib/bash_completion
diffstat 1 files changed, 38 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/bash_completion	Thu Feb 02 07:50:20 2006 +0100
+++ b/contrib/bash_completion	Thu Feb 02 08:16:17 2006 +0100
@@ -4,34 +4,34 @@
 {
     "$hg" --debug help 2>/dev/null | \
 	awk 'function command_line(line) {
-		 gsub(/,/, "", line)
-		 gsub(/:.*/, "", line)
-		 split(line, aliases)
-		 command = aliases[1]
-		 delete aliases[1]
-		 print command
-		 for (i in aliases)
-		     if (index(command, aliases[i]) != 1)
-			 print aliases[i]
-	     }
-	     /^list of commands:/ {commands=1}
-	     commands && /^ debug/ {a[i++] = $0; next;}
-	     commands && /^ [^ ]/ {command_line($0)}
-	     /^global options:/ {exit 0}
-	     END {for (i in a) command_line(a[i])}'
+		gsub(/,/, "", line)
+		gsub(/:.*/, "", line)
+		split(line, aliases)
+		command = aliases[1]
+		delete aliases[1]
+		print command
+		for (i in aliases)
+		    if (index(command, aliases[i]) != 1)
+			print aliases[i]
+	    }
+	    /^list of commands:/ {commands=1}
+	    commands && /^ debug/ {a[i++] = $0; next;}
+	    commands && /^ [^ ]/ {command_line($0)}
+	    /^global options:/ {exit 0}
+	    END {for (i in a) command_line(a[i])}'
 
 }
 
 _hg_option_list()
 {
-    "$hg" -v help $1 2> /dev/null | \
-        awk '/^ *-/ {
-		 for (i = 1; i <= NF; i ++) {
+    "$hg" -v help $1 2>/dev/null | \
+	awk '/^ *-/ {
+		for (i = 1; i <= NF; i ++) {
 		    if (index($i, "-") != 1)
-			 break;
+			break;
 		    print $i;
-		 }
-	     }'
+		}
+	    }'
 }
 
 
@@ -56,29 +56,29 @@
 
 _hg_paths()
 {
-    local paths="$("$hg" paths 2> /dev/null | sed -e 's/ = .*$//')"
-    COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$paths' -- "$cur" ))
+    local paths="$("$hg" paths 2>/dev/null | sed -e 's/ = .*$//')"
+    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$paths' -- "$cur"))
 }
 
 _hg_repos()
 {
     local i
-    for i in $( compgen -d -- "$cur" ); do
-        test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i")
+    for i in $(compgen -d -- "$cur"); do
+	test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i")
     done
 }
 
 _hg_status()
 {
-    local files="$( "$hg" status -n$1 . 2> /dev/null)"
-    COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$files' -- "$cur" ))
+    local files="$("$hg" status -n$1 . 2>/dev/null)"
+    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
 }
 
 _hg_tags()
 {
-    local tags="$("$hg" tags 2> /dev/null |
-                      sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
-    COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur") )
+    local tags="$("$hg" tags 2>/dev/null |
+	sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
+    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur"))
 }
 
 # this is "kind of" ugly...
@@ -87,7 +87,7 @@
     local i count=0
     local filters="$1"
 
-    for (( i=1; $i<=$COMP_CWORD; i++ )); do
+    for ((i=1; $i<=$COMP_CWORD; i++)); do
 	if [[ "${COMP_WORDS[i]}" != -* ]]; then
 	    if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then
 		continue
@@ -113,7 +113,7 @@
     # searching for the command
     # (first non-option argument that doesn't follow a global option that
     #  receives an argument)
-    for (( i=1; $i<=$COMP_CWORD; i++ )); do
+    for ((i=1; $i<=$COMP_CWORD; i++)); do
 	if [[ ${COMP_WORDS[i]} != -* ]]; then
 	    if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
 		cmd="${COMP_WORDS[i]}"
@@ -125,7 +125,7 @@
     if [[ "$cur" == -* ]]; then
 	opts=$(_hg_option_list $cmd)
 
-	COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur") )
+	COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur"))
 	return
     fi
 
@@ -147,7 +147,7 @@
     fi
 
     # canonicalize command name
-    cmd=$("$hg" -q help "$cmd" 2> /dev/null | sed -e 's/^hg //; s/ .*//; 1q')
+    cmd=$("$hg" -q help "$cmd" 2>/dev/null | sed -e 's/^hg //; s/ .*//; 1q')
 
     if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then
 	_hg_tags
@@ -191,17 +191,17 @@
 	    if [ $count = 1 ]; then
 		_hg_paths
 	    fi
-            _hg_repos
+	    _hg_repos
 	;;
 	debugindex|debugindexdot)
-	    COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -X "!*.i" -- "$cur" ))
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.i" -- "$cur"))
 	;;
 	debugdata)
-	    COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -X "!*.d" -- "$cur" ))
+	    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.d" -- "$cur"))
 	;;
     esac
 
 }
 
-complete -o bashdefault -o default -F _hg hg 2> /dev/null \
+complete -o bashdefault -o default -F _hg hg 2>/dev/null \
     || complete -o default -F _hg hg