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