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

Ville Skyttä ville.skytta at iki.fi
Mon Jun 8 21:14:51 UTC 2009


The following commit has been merged in the master branch:
commit 2e641b5c6ffe8e3f83ea4611ddc572b1da2efed3
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Jun 9 00:13:20 2009 +0300

    Improve rpm group completion.
    
    Displayed completions are still wrong but now at least real ones containing
    spaces do work and unusual input does not cause grep errors.
    http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-May/001486.html

diff --git a/CHANGES b/CHANGES
index 4e99a90..fb658ed 100644
--- a/CHANGES
+++ b/CHANGES
@@ -87,6 +87,7 @@ bash-completion (1.x)
   * Split FreeBSD pkg_* completion to contrib/pkg_install.
   * Split FreeBSD portupgrade and friends completion to contrib/portupgrade.
   * Split Slackware pkgtools completion to contrib/pkgtools.
+  * Improve rpm group completion (displayed completions are still wrong).
 
   [ Todd Zullinger ]
   * Make yum complete on filenames after install, deplist, update and upgrade
diff --git a/contrib/rpm b/contrib/rpm
index 82aecaa..643e0a2 100644
--- a/contrib/rpm
+++ b/contrib/rpm
@@ -22,13 +22,11 @@ _rpm_installed_packages()
 
 _rpm_groups()
 {
-	local IFS=$'\t'
-	# remove trailing backslash, or grep will complain
-	cur=${cur%"\\"}
-	COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat '%{group}\n' | \
-		       grep "^$cur" ) )
-	# backslash escape spaces and translate newlines to tabs
-	COMPREPLY=( $( echo "${COMPREPLY[@]}" | sed 's/ /\\ /g' | tr '\n' '\t' ) )
+	# TODO: shown completions are wrong but real ones work nevertheless
+	# http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-May/001486.html
+	local IFS=$'\n'
+	COMPREPLY=( $( compgen -W "$( rpm -qa $nodig $nosig --queryformat \
+		'%{group}\n' )" -- $cur ) )
 }
 
 _rpm_nodigsig()

-- 
bash-completion



More information about the Bash-completion-commits mailing list