[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 9cb6c0e14d0176b31f76a18a6b0df8cad895c50d
Author: Guillaume Rousse <guillomovitch at zarb.org>
Date:   Sun May 17 21:57:13 2009 +0200

    split cpio completion

diff --git a/bash_completion b/bash_completion
index 227a421..4a7f09a 100644
--- a/bash_completion
+++ b/bash_completion
@@ -8144,117 +8144,6 @@ _pkg_config()
 } &&
 complete -F _pkg_config pkg-config
 
-
-# cpio(1) completion
-#
-have cpio && {
-_cpio_format()
-{
-	COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ) )
-}
-
-_cpio()
-{
-	local cur
-
-	COMPREPLY=()
-	cur=`_get_cword`
-	prev=${COMP_WORDS[COMP_CWORD-1]}
-
-	# --name value style option
-	case $prev in
-		-H)
-			_cpio_format
-			return 0
-			;;
-		-@(E|F|I))
-			_filedir
-			return 0
-			;;
-		-R)
-			_usergroup
-			return 0
-			;;
-	esac
-
-	# --name=value style option
-	if [[ "$cur" == *=* ]]; then
-		prev=${cur/=*/}
-		cur=${cur/*=/}
-		case $prev in
-			--format)
-				_cpio_format
-				return 0
-				;;
-			--@(file|pattern-file))
-				_filedir
-				return 0
-				;;
-			--owner)
-				_usergroup
-				return 0
-				;;
-			--rsh-command)
-				COMPREPLY=( $( compgen -c -- $cur ) )
-				return 0
-				;;
-		esac
-	fi
-
-	if [ $COMP_CWORD -eq 1 ]; then
-		COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) )
-	else
-		case ${COMP_WORDS[1]} in
-			-@(o|-create))
-				if [[ "$cur" == -* ]]; then
-					COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
-						-L -V -C -H -M -O -F --file= --format=\
-						--message= --null --reset-access-time\
-						--verbose --dot --append --block-size=\
-						--dereference --io-size= --quiet\
-						--force-local --rsh-command= --help\
-						--version' -- $cur ) )
-				fi
-				;;
-			-@(i|-extract))
-				if [[ "$cur" == -* ]]; then
-					COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
-						-t -s -u -v -B -S -V -C -E -H -M -R -I\
-						-F --file= --make-directories\
-						--nonmatching\
-						--preserve-modification-time\
-						--numeric-uid-gid --rename -t --list\
-						--swap-bytes --swap --dot\
-						--unconditional --verbose --block-size=\
-						--swap-halfwords --io-size=\
-						--pattern-file= --format= --owner=\
-						--no-preserve-owner --message=\
-						--force-local --no-absolute-filenames\
-						--sparse --only-verify-crc --quiet\
-						--rsh-command= --help\
-						--version' -- $cur ) )
-				fi
-				;;
-			-@(p|-pass-through))
-				if [[ "$cur" == -* ]]; then
-					COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
-						-L -V -R --null --reset-access-time\
-						--make-directories --link --quiet\
-						--preserve-modification-time\
-						--unconditional --verbose --dot\
-						--dereference --owner=\
-						--no-preserve-owner --sparse --help\
-						--version' -- $cur ) )
-				else
-					_filedir -d
-				fi
-				;;
-		esac
-	fi
-}
-complete -F _cpio cpio
-}
-
 # id(1) completion
 #
 have id &&
diff --git a/contrib/cpio b/contrib/cpio
new file mode 100644
index 0000000..aed3155
--- /dev/null
+++ b/contrib/cpio
@@ -0,0 +1,112 @@
+# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
+# ex: ts=8 sw=8 noet filetype=sh
+#
+# bash completion for cpio
+
+have cpio && {
+_cpio_format()
+{
+	COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ) )
+}
+
+_cpio()
+{
+	local cur
+
+	COMPREPLY=()
+	cur=`_get_cword`
+	prev=${COMP_WORDS[COMP_CWORD-1]}
+
+	# --name value style option
+	case $prev in
+		-H)
+			_cpio_format
+			return 0
+			;;
+		-@(E|F|I))
+			_filedir
+			return 0
+			;;
+		-R)
+			_usergroup
+			return 0
+			;;
+	esac
+
+	# --name=value style option
+	if [[ "$cur" == *=* ]]; then
+		prev=${cur/=*/}
+		cur=${cur/*=/}
+		case $prev in
+			--format)
+				_cpio_format
+				return 0
+				;;
+			--@(file|pattern-file))
+				_filedir
+				return 0
+				;;
+			--owner)
+				_usergroup
+				return 0
+				;;
+			--rsh-command)
+				COMPREPLY=( $( compgen -c -- $cur ) )
+				return 0
+				;;
+		esac
+	fi
+
+	if [ $COMP_CWORD -eq 1 ]; then
+		COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) )
+	else
+		case ${COMP_WORDS[1]} in
+			-@(o|-create))
+				if [[ "$cur" == -* ]]; then
+					COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
+						-L -V -C -H -M -O -F --file= --format=\
+						--message= --null --reset-access-time\
+						--verbose --dot --append --block-size=\
+						--dereference --io-size= --quiet\
+						--force-local --rsh-command= --help\
+						--version' -- $cur ) )
+				fi
+				;;
+			-@(i|-extract))
+				if [[ "$cur" == -* ]]; then
+					COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
+						-t -s -u -v -B -S -V -C -E -H -M -R -I\
+						-F --file= --make-directories\
+						--nonmatching\
+						--preserve-modification-time\
+						--numeric-uid-gid --rename -t --list\
+						--swap-bytes --swap --dot\
+						--unconditional --verbose --block-size=\
+						--swap-halfwords --io-size=\
+						--pattern-file= --format= --owner=\
+						--no-preserve-owner --message=\
+						--force-local --no-absolute-filenames\
+						--sparse --only-verify-crc --quiet\
+						--rsh-command= --help\
+						--version' -- $cur ) )
+				fi
+				;;
+			-@(p|-pass-through))
+				if [[ "$cur" == -* ]]; then
+					COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
+						-L -V -R --null --reset-access-time\
+						--make-directories --link --quiet\
+						--preserve-modification-time\
+						--unconditional --verbose --dot\
+						--dereference --owner=\
+						--no-preserve-owner --sparse --help\
+						--version' -- $cur ) )
+				else
+					_filedir -d
+				fi
+				;;
+		esac
+	fi
+}
+complete -F _cpio cpio
+}

-- 
bash-completion



More information about the Bash-completion-commits mailing list