Improve rpm query option completions.

Add --nomanifest, --all, --file, --fileid, --ftswalk, --group, --hdrid,
--package, --pkgid, and --specfile; suggest --triggeredby, --whatprovides,
and --whatrequires only in installed package query mode.
This commit is contained in:
Ville Skyttä 2010-09-05 10:44:10 +03:00
parent c8fb5f2eb1
commit a26e92e6f3
2 changed files with 11 additions and 8 deletions

View File

@ -17,6 +17,7 @@ bash-completion (2.x)
* Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions. * Add *.xsd, *.xsl, *.rng, and *.wsdl to xmllint filename completions.
* Recognize rpm query mode based on the --file, --group, --package, and * Recognize rpm query mode based on the --file, --group, --package, and
--all long options (RedHat: #630328). --all long options (RedHat: #630328).
* Improve rpm query option completions.
[ Freddy Vulto ] [ Freddy Vulto ]
* Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095) * Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095)

View File

@ -142,7 +142,7 @@ _rpm()
-- "$cur" ) ) -- "$cur" ) )
return 0 return 0
;; ;;
--define|-D) --define|-D|--fileid|--hdrid|--pkgid)
# argument required but no completions available # argument required but no completions available
return 0 return 0
;; ;;
@ -180,10 +180,9 @@ _rpm()
# options common to all query types # options common to all query types
opts="$opts --changelog --configfiles --conflicts --docfiles opts="$opts --changelog --configfiles --conflicts --docfiles
--dump --enhances --filesbypkg --filecaps --fileclass --dump --enhances --filesbypkg --filecaps --fileclass
--filecolor --fileprovide --filerequire --filesbypkg --filecolor --fileprovide --filerequire --filesbypkg --info
--info --list --obsoletes --pipe --provides --list --obsoletes --pipe --provides --queryformat --rcfile
--queryformat --rcfile --requires --scripts --suggests --requires --scripts --suggests --triggers --xml"
--triggeredby --triggers --whatprovides --whatrequires --xml"
if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then
# -qf completion # -qf completion
@ -200,15 +199,18 @@ _rpm()
# -qp; uninstalled package completion # -qp; uninstalled package completion
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \ COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \
--httpport --httpproxy" -- "$cur" ) ) --httpport --httpproxy --nomanifest" -- "$cur" ) )
else else
_filedir 'rpm' _filedir 'rpm'
fi fi
else else
# -q; installed package completion # -q; installed package completion
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ COMPREPLY=( $( compgen -W "$opts --all --file --fileid
--last --root --state" -- "$cur" ) ) --dbpath --fscontext --ftswalk --group --hdrid --last
--package --pkgid --root --specfile --state
--triggeredby --whatprovides --whatrequires" \
-- "$cur" ) )
elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then
_rpm_installed_packages "$nodig" "$nosig" _rpm_installed_packages "$nodig" "$nosig"
fi fi