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

Guillaume Rousse guillomovitch at zarb.org
Sun May 17 20:13:19 UTC 2009


The following commit has been merged in the master branch:
commit 944221c4d15dcac7eadbad9692f6c6b2f0276d2b
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date:   Sun May 17 21:55:41 2009 +0200

    split getent completion

diff --git a/bash_completion b/bash_completion
index 8e51a10..227a421 100644
--- a/bash_completion
+++ b/bash_completion
@@ -8274,56 +8274,6 @@ _id()
 } &&
 complete -F _id id
 
-# getent(1) completion
-#
-have getent &&
-_getent()
-{
-	local cur prev
-
-	COMPREPLY=()
-	cur=`_get_cword`
-	prev=${COMP_WORDS[COMP_CWORD-1]}
-
-	case $prev in
-		passwd)
-			COMPREPLY=( $( compgen -u $cur  ) )
-			return 0
-			;;
-		group)
-			COMPREPLY=( $( compgen -g $cur  ) )
-			return 0
-			;;
-		services)
-			COMPREPLY=( $( compgen -s $cur  ) )
-			return 0
-			;;
-		hosts)
-			COMPREPLY=( $( compgen -A hostname $cur  ) )
-			return 0
-			;;
-		protocols|networks|ahosts|ahostsv4|ahostsv6|rpc)
-			COMPREPLY=( $( getent $prev | \
-				sed -ne 's|^\('$cur'[^[:space:]]*\).*|\1|p' ) )
-			return 0
-			;;
-		aliases|shadow)
-			COMPREPLY=( $( getent $prev | \
-				sed -ne 's|^\('$cur'[^:]*\).*|\1|p' ) )
-			return 0
-			;;
-	esac
-
-
-	if [ $COMP_CWORD -eq 1 ]; then
-		COMPREPLY=( $( compgen -W 'passwd group hosts services \
-					   protocols networks ahosts ahostsv4 \
-					   ahostsv6 aliases ethers netgroup \
-					   rpc shadow' -- $cur ) )
-	fi
-} &&
-complete -F _getent getent
-
 # sysctl(8) completion
 #
 have sysctl &&
diff --git a/contrib/getent b/contrib/getent
new file mode 100644
index 0000000..a08bd19
--- /dev/null
+++ b/contrib/getent
@@ -0,0 +1,52 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for getent
+
+have getent &&
+_getent()
+{
+	local cur prev
+
+	COMPREPLY=()
+	cur=`_get_cword`
+	prev=${COMP_WORDS[COMP_CWORD-1]}
+
+	case $prev in
+		passwd)
+			COMPREPLY=( $( compgen -u $cur  ) )
+			return 0
+			;;
+		group)
+			COMPREPLY=( $( compgen -g $cur  ) )
+			return 0
+			;;
+		services)
+			COMPREPLY=( $( compgen -s $cur  ) )
+			return 0
+			;;
+		hosts)
+			COMPREPLY=( $( compgen -A hostname $cur  ) )
+			return 0
+			;;
+		protocols|networks|ahosts|ahostsv4|ahostsv6|rpc)
+			COMPREPLY=( $( getent $prev | \
+				sed -ne 's|^\('$cur'[^[:space:]]*\).*|\1|p' ) )
+			return 0
+			;;
+		aliases|shadow)
+			COMPREPLY=( $( getent $prev | \
+				sed -ne 's|^\('$cur'[^:]*\).*|\1|p' ) )
+			return 0
+			;;
+	esac
+
+
+	if [ $COMP_CWORD -eq 1 ]; then
+		COMPREPLY=( $( compgen -W 'passwd group hosts services \
+					   protocols networks ahosts ahostsv4 \
+					   ahostsv6 aliases ethers netgroup \
+					   rpc shadow' -- $cur ) )
+	fi
+} &&
+complete -F _getent getent

-- 
bash-completion



More information about the Bash-completion-commits mailing list