[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 7522b94f33ab0a6d042d7a6fe3ea5b9269ced2a8

Guillaume Rousse guillomovitch at zarb.org
Mon Jun 8 14:51:27 UTC 2009


The following commit has been merged in the master branch:
commit 7f83cb5816303a111f97b508e6c4855bc09bc472
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date:   Mon Jun 8 16:46:26 2009 +0200

    split route completion

diff --git a/bash_completion b/bash_completion
index 786b173..60a94e5 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1204,42 +1204,6 @@ _known_hosts_real()
 complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
 	ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr
 
-# Linux route(8) completion
-#
-[ $UNAME = Linux ] &&
-_route()
-{
-	local cur prev
-
-	COMPREPLY=()
-	cur=`_get_cword`
-	prev=${COMP_WORDS[COMP_CWORD-1]}
-
-	if [ "$prev" = dev ]; then
-	    COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ))
-	    return 0
-	fi
-
-	COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
-				   window irtt reject mod dyn reinstate dev \
-				   default gw' -- $cur ) )
-
-	COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
-		       (while read -d ' ' i; do
-			   [ "$i" == "" ] && continue
-			   # flatten array with spaces on either side,
-			   # otherwise we cannot grep on word
-			   # boundaries of first and last word
-			   COMPREPLY=" ${COMPREPLY[@]} "
-			   # remove word from list of completions
-			   COMPREPLY=( ${COMPREPLY/ $i / } )
-			done
-		       echo "${COMPREPLY[@]}")
-		  ) )
-	return 0
-}
-[ $UNAME = Linux ] && complete -F _route route
-
 # This meta-cd function observes the CDPATH variable, so that cd additionally
 # completes on directories under those specified in CDPATH.
 #
diff --git a/contrib/net-tools b/contrib/net-tools
index 1c3c20a..a443bd2 100644
--- a/contrib/net-tools
+++ b/contrib/net-tools
@@ -72,3 +72,39 @@ _mii_diag()
 	fi
 } &&
 complete -F _mii_diag $default mii-diag
+
+# Linux route(8) completion
+#
+[ $UNAME = Linux ] &&
+_route()
+{
+	local cur prev
+
+	COMPREPLY=()
+	cur=`_get_cword`
+	prev=${COMP_WORDS[COMP_CWORD-1]}
+
+	if [ "$prev" = dev ]; then
+	    COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ))
+	    return 0
+	fi
+
+	COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
+				   window irtt reject mod dyn reinstate dev \
+				   default gw' -- $cur ) )
+
+	COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
+		       (while read -d ' ' i; do
+			   [ "$i" == "" ] && continue
+			   # flatten array with spaces on either side,
+			   # otherwise we cannot grep on word
+			   # boundaries of first and last word
+			   COMPREPLY=" ${COMPREPLY[@]} "
+			   # remove word from list of completions
+			   COMPREPLY=( ${COMPREPLY/ $i / } )
+			done
+		       echo "${COMPREPLY[@]}")
+		  ) )
+	return 0
+}
+[ $UNAME = Linux ] && complete -F _route route

-- 
bash-completion



More information about the Bash-completion-commits mailing list