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

Ville Skyttä ville.skytta at iki.fi
Thu Apr 30 15:59:35 UTC 2009


The following commit has been merged in the master branch:
commit d8d5445edb775254c89f812f7c88652725074d3d
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Thu Apr 30 18:54:07 2009 +0300

    Split ant completion to contrib/ant.

diff --git a/CHANGES b/CHANGES
index 085d98c..7d83356 100644
--- a/CHANGES
+++ b/CHANGES
@@ -45,6 +45,7 @@ bash-completion (1.x)
   * Add make --old/new-file, --assume-old/new, --what-if value completions.
   * Add smartctl -n/--nocheck completion, add more other value completions.
   * Fix leaking $prev from mkinitrd completion.
+  * Split ant completion to contrib/ant.
 
   [ Todd Zullinger ]
   * Make yum complete on filenames after install, deplist, update and upgrade
diff --git a/Makefile.am b/Makefile.am
index f084da3..80f571a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,8 @@
 sysconf_DATA = bash_completion
 
 bashcompdir = $(sysconfdir)/bash_completion.d
-bashcomp_DATA = contrib/apache2ctl \
+bashcomp_DATA = contrib/ant \
+		contrib/apache2ctl \
 		contrib/bitkeeper \
 		contrib/bittorrent \
 		contrib/brctl \
diff --git a/bash_completion b/bash_completion
index 461ca35..98f4170 100644
--- a/bash_completion
+++ b/bash_completion
@@ -3409,59 +3409,6 @@ _root_command()
 }
 complete -F _root_command $filenames sudo fakeroot really gksudo gksu kdesudo
 
-# ant(1) completion
-#
-have ant && {
-_ant()
-{
-	local cur prev buildfile i
-
-	COMPREPLY=()
-	cur=`_get_cword`
-	prev=${COMP_WORDS[COMP_CWORD-1]}
-
-	case "$prev" in
-		-buildfile|-f)
-			_filedir 'xml'
-			return 0
-			;;
-		-logfile)
-			_filedir
-			return 0
-			;;
-	esac
-
-	if [[ "$cur" == -* ]]; then
-		# relevant options completion
-		COMPREPLY=( $( compgen -W '-help -projecthelp -version -quiet \
-			       -verbose -debug -emacs -logfile -logger \
-			       -listener -buildfile -f -D -find' -- $cur ) )
-	else
-		# available targets completion
-		# find which buildfile to use
-		buildfile=build.xml
-		for (( i=1; i < COMP_CWORD; i++ )); do
-			if [[ "${COMP_WORDS[i]}" == -buildfile ]]; then
-				buildfile=${COMP_WORDS[i+1]}
-				break
-			fi
-		done
-		[ ! -f $buildfile ] && return 0
-
-		# parse buildfile for targets
-		COMPREPLY=( $( awk -F'"' '/<target name="/ {print $2}' \
-				$buildfile | grep "^$cur" )
-			    $( awk -F"'" "/<target name='/ "'{print $2}' \
-				$buildfile | grep "^$cur" )
-			    $( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' \
-				$buildfile | grep "^$cur" ) )
-	fi
-}
-have complete-ant-cmd.pl && \
-     complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
-     complete -F _ant $filenames ant
-}
-
 have nslookup &&
 _nslookup()
 {
diff --git a/contrib/ant b/contrib/ant
new file mode 100644
index 0000000..a73b683
--- /dev/null
+++ b/contrib/ant
@@ -0,0 +1,55 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for ant
+
+have ant && {
+_ant()
+{
+	local cur prev buildfile i
+
+	COMPREPLY=()
+	cur=`_get_cword`
+	prev=${COMP_WORDS[COMP_CWORD-1]}
+
+	case "$prev" in
+		-buildfile|-f)
+			_filedir 'xml'
+			return 0
+			;;
+		-logfile)
+			_filedir
+			return 0
+			;;
+	esac
+
+	if [[ "$cur" == -* ]]; then
+		# relevant options completion
+		COMPREPLY=( $( compgen -W '-help -projecthelp -version -quiet \
+			       -verbose -debug -emacs -logfile -logger \
+			       -listener -buildfile -f -D -find' -- $cur ) )
+	else
+		# available targets completion
+		# find which buildfile to use
+		buildfile=build.xml
+		for (( i=1; i < COMP_CWORD; i++ )); do
+			if [[ "${COMP_WORDS[i]}" == -buildfile ]]; then
+				buildfile=${COMP_WORDS[i+1]}
+				break
+			fi
+		done
+		[ ! -f $buildfile ] && return 0
+
+		# parse buildfile for targets
+		COMPREPLY=( $( awk -F'"' '/<target name="/ {print $2}' \
+				$buildfile | grep "^$cur" )
+			    $( awk -F"'" "/<target name='/ "'{print $2}' \
+				$buildfile | grep "^$cur" )
+			    $( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' \
+				$buildfile | grep "^$cur" ) )
+	fi
+}
+have complete-ant-cmd.pl && \
+     complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
+     complete -F _ant $filenames ant
+}

-- 
bash-completion



More information about the Bash-completion-commits mailing list