Skip to content

Commit fa21b5c

Browse files
committed
*: cleanups
1 parent 3e419c3 commit fa21b5c

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

completions/complete

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ _complete()
3737

3838
if [[ $cur == -* ]]; then
3939
# relevant options completion
40-
local opts="-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X"
41-
[[ $1 != compgen ]] && opts+=" -F -C"
42-
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
40+
local -a opts=(-a -b -c -d -e -f -g -j -k -o -s -u -v -A -G -W -P -S -X)
41+
[[ $1 != compgen ]] && opts+=(-F -C)
42+
COMPREPLY=($(compgen -W '${opts[@]}' -- "$cur"))
4343
else
4444
COMPREPLY=($(compgen -A command -- "$cur"))
4545
fi

completions/pkg-get

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ _pkg_get_get_catalog_file()
5858
fi
5959

6060
if [[ ${cur} == -* ]]; then
61-
local opts="-c -d -D -f -i -l -s -S -u -U -v"
62-
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
61+
local -a opts=(-c -d -D -f -i -l -s -S -u -U -v)
62+
COMPREPLY=($(compgen -W '${opts[@]}' -- ${cur}))
6363
return
6464
fi
6565

66-
local commands="available describe download install list \
67-
updatecatalog upgrade"
68-
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
66+
local -a commands=(
67+
available describe download install list updatecatalog upgrade
68+
)
69+
COMPREPLY=($(compgen -W '${commands[@]}' -- ${cur}))
6970
} &&
7071
complete -F _pkg_get pkg-get
7172

completions/pkgadd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ _pkgadd()
3636

3737
*)
3838
if [[ ${cur} == -* ]]; then
39-
local opts="-a -A -d -k -n -M -P -r -R -s -v -V -x"
40-
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
39+
local -a opts=(-a -A -d -k -n -M -P -r -R -s -v -V -x)
40+
COMPREPLY=($(compgen -W '${opts[@]}' -- ${cur}))
4141
else
4242
local pkginst_list
4343
if [[ -d $device ]]; then

completions/rpm

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,45 +118,49 @@ _rpm()
118118
$split && return
119119

120120
# 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+
)
123125

124126
case ${words[1]} in
125127
-[iFU]* | --install | --freshen | --upgrade)
126128
if [[ $cur == -* ]]; then
127-
COMPREPLY=($(compgen -W "$opts --percent --force --test
129+
COMPREPLY=($(compgen -W '${opts[@]} --percent --force --test
128130
--replacepkgs --replacefiles --root --excludedocs --includedocs
129131
--noscripts --ignorearch --dbpath --prefix= --ignoreos --nodeps
130132
--allfiles --ftpproxy --ftpport --justdb --httpproxy --httpport
131133
--noorder --relocate= --badreloc --notriggers --excludepath=
132134
--ignoresize --oldpackage --queryformat --repackage
133-
--nosuggests" -- "$cur"))
135+
--nosuggests' -- "$cur"))
134136
else
135137
_filedir '[rs]pm'
136138
fi
137139
;;
138140
-e | --erase)
139141
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"))
142144
else
143145
_rpm_installed_packages $1
144146
fi
145147
;;
146148
-q* | --query)
147149
# options common to all query types
148-
opts+=" --changelog --configfiles --conflicts --docfiles --dump
150+
opts+=(
151+
--changelog --configfiles --conflicts --docfiles --dump
149152
--enhances --filesbypkg --filecaps --fileclass --filecolor
150153
--fileprovide --filerequire --filesbypkg --info --list
151154
--obsoletes --pipe --provides --queryformat= --requires
152155
--scripts --suggests --triggers --xml --recommends
153-
--supplements --filetriggers --licensefiles"
156+
--supplements --filetriggers --licensefiles
157+
)
154158

155159
if [[ ${words[*]} == *\ -@(*([^ -])f|-file )* ]]; then
156160
# -qf completion
157161
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"))
160164
else
161165
_filedir
162166
fi
@@ -166,41 +170,40 @@ _rpm()
166170
elif [[ ${words[*]} == *\ -@(*([^ -])p|-package )* ]]; then
167171
# -qp; uninstalled package completion
168172
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"))
171175
else
172176
_filedir '[rs]pm'
173177
fi
174178
else
175179
# -q; installed package completion
176180
if [[ $cur == -* ]]; then
177-
COMPREPLY=($(compgen -W "$opts --all --file --fileid
181+
COMPREPLY=($(compgen -W '${opts[@]} --all --file --fileid
178182
--dbpath --fscontext --ftswalk --group --hdrid --last
179183
--package --pkgid --root= --specfile --state
180184
--triggeredby --whatenhances --whatprovides
181185
--whatrecommends --whatrequires --whatsuggests
182-
--whatsupplements" \
183-
-- "$cur"))
186+
--whatsupplements' -- "$cur"))
184187
elif [[ ${words[*]} != *\ -@(*([^ -])a|-all )* ]]; then
185188
_rpm_installed_packages $1
186189
fi
187190
fi
188191
;;
189192
-K* | --checksig)
190193
if [[ $cur == -* ]]; then
191-
COMPREPLY=($(compgen -W "$opts --nopgp --nogpg --nomd5" \
194+
COMPREPLY=($(compgen -W '${opts[@]} --nopgp --nogpg --nomd5' \
192195
-- "$cur"))
193196
else
194197
_filedir '[rs]pm'
195198
fi
196199
;;
197200
-[Vy]* | --verify)
198201
if [[ $cur == -* ]]; then
199-
COMPREPLY=($(compgen -W "$opts --root= --dbpath --nodeps
202+
COMPREPLY=($(compgen -W '${opts[@]} --root= --dbpath --nodeps
200203
--nogroup --nolinkto --nomode --nomtime --nordev --nouser
201204
--nofiles --noscripts --nomd5 --querytags --specfile
202205
--whatenhances --whatprovides --whatrecommends
203-
--whatrequires --whatsuggests --whatsupplements" \
206+
--whatrequires --whatsuggests --whatsupplements' \
204207
-- "$cur"))
205208
# check whether we're doing file completion
206209
elif [[ ${words[*]} == *\ -@(*([^ -])f|-file )* ]]; then

0 commit comments

Comments
 (0)