diff --git a/CHANGES b/CHANGES index 4e99a90a..fb658ed6 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 82aecaae..643e0a21 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()