diff --git a/contrib/rpm b/contrib/rpm index 20f9852..d268cab 100644 --- a/contrib/rpm +++ b/contrib/rpm @@ -142,7 +142,7 @@ _rpm() -- "$cur" ) ) return 0 ;; - --define|-D) + --define|-D|--fileid|--hdrid|--pkgid) # argument required but no completions available return 0 ;; @@ -180,12 +180,11 @@ _rpm() # options common to all query types opts="$opts --changelog --configfiles --conflicts --docfiles --dump --enhances --filesbypkg --filecaps --fileclass - --filecolor --fileprovide --filerequire --filesbypkg - --info --list --obsoletes --pipe --provides - --queryformat --rcfile --requires --scripts --suggests - --triggeredby --triggers --whatprovides --whatrequires --xml" + --filecolor --fileprovide --filerequire --filesbypkg --info + --list --obsoletes --pipe --provides --queryformat --rcfile + --requires --scripts --suggests --triggers --xml" - if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then + if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then # -qf completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ @@ -193,23 +192,26 @@ _rpm() else _filedir fi - elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then # -qg completion _rpm_groups - elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then # -qp; uninstalled package completion if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \ - --httpport --httpproxy" -- "$cur" ) ) + --httpport --httpproxy --nomanifest" -- "$cur" ) ) else _filedir 'rpm' fi else # -q; installed package completion if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ - --last --root --state" -- "$cur" ) ) - elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then + COMPREPLY=( $( compgen -W "$opts --all --file --fileid + --dbpath --fscontext --ftswalk --group --hdrid --last + --package --pkgid --root --specfile --state + --triggeredby --whatprovides --whatrequires" \ + -- "$cur" ) ) + elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then _rpm_installed_packages "$nodig" "$nosig" fi fi @@ -229,11 +231,11 @@ _rpm() --nofiles --noscripts --nomd5 --querytags --specfile \ --whatrequires --whatprovides" -- "$cur" ) ) # check whether we're doing file completion - elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then _filedir - elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then _rpm_groups - elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then + elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then _filedir 'rpm' else _rpm_installed_packages "$nodig" "$nosig"