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

Ville Skyttä ville.skytta at iki.fi
Mon Apr 13 21:55:57 UTC 2009


The following commit has been merged in the master branch:
commit 7e30ee814b2cc89318e510239fbc9a571008d893
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Apr 14 00:53:56 2009 +0300

    Fix rpm --whatrequires/--whatprovides completions with spaces and
    other unusual characters, add filename based --whatrequires
    completion.

diff --git a/CHANGES b/CHANGES
index a1134cf..c971dfc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -21,6 +21,8 @@ bash-completion (1.x)
     canonical dicts from "aspell dicts".
   * Always use /etc/shells for chsh -s completion, don't complete on comment
     lines in it.
+  * Fix rpm --whatrequires/--whatprovides completions with spaces and other
+    unusual characters, add filename based --whatrequires completions.
 
   [ Todd Zullinger ]
   * Make yum complete on filenames after install, deplist, update and upgrade
diff --git a/bash_completion b/bash_completion
index 6f84e31..db82674 100644
--- a/bash_completion
+++ b/bash_completion
@@ -2062,16 +2062,24 @@ _rpm()
 		if [[ "$cur" == */* ]]; then
 			_filedir
 		else
-		# complete on capabilities
-			COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
-					'%{providename}\n' | grep "^$cur" ) )
+			# complete on capabilities
+			local IFS=$'\n'
+			COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
+					--queryformat='%{providename}\n' )" \
+					-- $cur ) )
 		fi
 		return 0
 		;;
 	--whatrequires)
-		# complete on capabilities
-		COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
-				'%{requirename}\n' | grep "^$cur" ) )
+		if [[ "$cur" == */* ]]; then
+			_filedir
+		else
+			# complete on capabilities
+			local IFS=$'\n'
+			COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig \
+					--queryformat='%{requirename}\n' )" \
+					-- $cur ) )
+		fi
 		return 0
 		;;
 	--target)

-- 
bash-completion



More information about the Bash-completion-commits mailing list