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

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


The following commit has been merged in the master branch:
commit 0d9669892b93556ceacb5e55543a9c4a9002de17
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date:   Mon Jun 8 16:45:09 2009 +0200

    split yp-tools completion

diff --git a/Makefile.am b/Makefile.am
index 6e6386d..ee5e2fc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -131,6 +131,7 @@ bashcomp_DATA = contrib/ant \
 		contrib/xm \
 		contrib/xmllint \
 		contrib/xrandr \
+		contrib/yp-tools \
 		contrib/yum
 
 EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA) to_review \
diff --git a/bash_completion b/bash_completion
index ff31893..786b173 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1591,34 +1591,6 @@ _look()
 } &&
 complete -F _look $default look
 
-# ypcat(1) and ypmatch(1) completion
-#
-have ypmatch &&
-_ypmatch()
-{
-	local cur map
-
-	COMPREPLY=()
-	cur=`_get_cword`
-
-	[ $1 = ypcat ] && [ $COMP_CWORD -gt 1 ] && return 0
-	[ $1 = ypmatch ] && [ $COMP_CWORD -gt 2 ] && return 0
-
-	if [ $1 = ypmatch ] && [ $COMP_CWORD -eq 1 ] && \
-	   [ ${#COMP_WORDS[@]} -eq 3 ]; then
-		map=${COMP_WORDS[2]}
-		COMPREPLY=( $( compgen -W '$( ypcat $map | \
-						cut -d':' -f 1 )' -- $cur) )
-	else
-		[ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0
-		COMPREPLY=( $( compgen -W \
-			      '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- $cur))
-	fi
-
-	return 0
-} &&
-complete -F _ypmatch ypmatch ypcat
-
 # CUPS cancel(1) completion
 #
 have cancel &&
diff --git a/contrib/yp-tools b/contrib/yp-tools
new file mode 100644
index 0000000..65722d2
--- /dev/null
+++ b/contrib/yp-tools
@@ -0,0 +1,30 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for yp-tools
+
+have ypmatch &&
+_ypmatch()
+{
+	local cur map
+
+	COMPREPLY=()
+	cur=`_get_cword`
+
+	[ $1 = ypcat ] && [ $COMP_CWORD -gt 1 ] && return 0
+	[ $1 = ypmatch ] && [ $COMP_CWORD -gt 2 ] && return 0
+
+	if [ $1 = ypmatch ] && [ $COMP_CWORD -eq 1 ] && \
+	   [ ${#COMP_WORDS[@]} -eq 3 ]; then
+		map=${COMP_WORDS[2]}
+		COMPREPLY=( $( compgen -W '$( ypcat $map | \
+						cut -d':' -f 1 )' -- $cur) )
+	else
+		[ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0
+		COMPREPLY=( $( compgen -W \
+			      '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- $cur))
+	fi
+
+	return 0
+} &&
+complete -F _ypmatch ypmatch ypcat

-- 
bash-completion



More information about the Bash-completion-commits mailing list