@@ -118,45 +118,49 @@ _rpm()
118
118
$split && return
119
119
120
120
# options common to all modes
121
- local opts=" --define= --eval= --macros= --nodigest --nosignature --rcfile=
122
- --quiet --pipe --verbose"
121
+ local -a opts=(
122
+ --define= --eval= --macros= --nodigest --nosignature --rcfile= --quiet
123
+ --pipe --verbose
124
+ )
123
125
124
126
case ${words[1]} in
125
127
-[iFU]* | --install | --freshen | --upgrade)
126
128
if [[ $cur == -* ]]; then
127
- COMPREPLY=($( compgen -W " $ opts --percent --force --test
129
+ COMPREPLY=($( compgen -W ' ${ opts[@]} --percent --force --test
128
130
--replacepkgs --replacefiles --root --excludedocs --includedocs
129
131
--noscripts --ignorearch --dbpath --prefix= --ignoreos --nodeps
130
132
--allfiles --ftpproxy --ftpport --justdb --httpproxy --httpport
131
133
--noorder --relocate= --badreloc --notriggers --excludepath=
132
134
--ignoresize --oldpackage --queryformat --repackage
133
- --nosuggests" -- " $cur " ) )
135
+ --nosuggests' -- " $cur " ) )
134
136
else
135
137
_filedir ' [rs]pm'
136
138
fi
137
139
;;
138
140
-e | --erase)
139
141
if [[ $cur == -* ]]; then
140
- COMPREPLY=($( compgen -W " $ opts --allmatches --noscripts
141
- --notriggers --nodeps --test --repackage" -- " $cur " ) )
142
+ COMPREPLY=($( compgen -W ' ${ opts[@]} --allmatches --noscripts
143
+ --notriggers --nodeps --test --repackage' -- " $cur " ) )
142
144
else
143
145
_rpm_installed_packages $1
144
146
fi
145
147
;;
146
148
-q* | --query)
147
149
# options common to all query types
148
- opts+=" --changelog --configfiles --conflicts --docfiles --dump
150
+ opts+=(
151
+ --changelog --configfiles --conflicts --docfiles --dump
149
152
--enhances --filesbypkg --filecaps --fileclass --filecolor
150
153
--fileprovide --filerequire --filesbypkg --info --list
151
154
--obsoletes --pipe --provides --queryformat= --requires
152
155
--scripts --suggests --triggers --xml --recommends
153
- --supplements --filetriggers --licensefiles"
156
+ --supplements --filetriggers --licensefiles
157
+ )
154
158
155
159
if [[ ${words[*]} == * \ -@ (* ([^ -])f| -file )* ]]; then
156
160
# -qf completion
157
161
if [[ $cur == -* ]]; then
158
- COMPREPLY=($( compgen -W " $ opts --dbpath --fscontext
159
- --last --root --state" -- " $cur " ) )
162
+ COMPREPLY=($( compgen -W ' ${ opts[@]} --dbpath --fscontext
163
+ --last --root --state' -- " $cur " ) )
160
164
else
161
165
_filedir
162
166
fi
@@ -166,41 +170,40 @@ _rpm()
166
170
elif [[ ${words[*]} == * \ -@ (* ([^ -])p| -package )* ]]; then
167
171
# -qp; uninstalled package completion
168
172
if [[ $cur == -* ]]; then
169
- COMPREPLY=($( compgen -W " $ opts --ftpport --ftpproxy
170
- --httpport --httpproxy --nomanifest" -- " $cur " ) )
173
+ COMPREPLY=($( compgen -W ' ${ opts[@]} --ftpport --ftpproxy
174
+ --httpport --httpproxy --nomanifest' -- " $cur " ) )
171
175
else
172
176
_filedir ' [rs]pm'
173
177
fi
174
178
else
175
179
# -q; installed package completion
176
180
if [[ $cur == -* ]]; then
177
- COMPREPLY=($( compgen -W " $ opts --all --file --fileid
181
+ COMPREPLY=($( compgen -W ' ${ opts[@]} --all --file --fileid
178
182
--dbpath --fscontext --ftswalk --group --hdrid --last
179
183
--package --pkgid --root= --specfile --state
180
184
--triggeredby --whatenhances --whatprovides
181
185
--whatrecommends --whatrequires --whatsuggests
182
- --whatsupplements" \
183
- -- " $cur " ) )
186
+ --whatsupplements' -- " $cur " ) )
184
187
elif [[ ${words[*]} != * \ -@ (* ([^ -])a| -all )* ]]; then
185
188
_rpm_installed_packages $1
186
189
fi
187
190
fi
188
191
;;
189
192
-K* | --checksig)
190
193
if [[ $cur == -* ]]; then
191
- COMPREPLY=($( compgen -W " $ opts --nopgp --nogpg --nomd5" \
194
+ COMPREPLY=($( compgen -W ' ${ opts[@]} --nopgp --nogpg --nomd5' \
192
195
-- " $cur " ) )
193
196
else
194
197
_filedir ' [rs]pm'
195
198
fi
196
199
;;
197
200
-[Vy]* | --verify)
198
201
if [[ $cur == -* ]]; then
199
- COMPREPLY=($( compgen -W " $ opts --root= --dbpath --nodeps
202
+ COMPREPLY=($( compgen -W ' ${ opts[@]} --root= --dbpath --nodeps
200
203
--nogroup --nolinkto --nomode --nomtime --nordev --nouser
201
204
--nofiles --noscripts --nomd5 --querytags --specfile
202
205
--whatenhances --whatprovides --whatrecommends
203
- --whatrequires --whatsuggests --whatsupplements" \
206
+ --whatrequires --whatsuggests --whatsupplements' \
204
207
-- " $cur " ) )
205
208
# check whether we're doing file completion
206
209
elif [[ ${words[*]} == * \ -@ (* ([^ -])f| -file )* ]]; then
0 commit comments