Skip to content

Commit 2a1a9e1

Browse files
committed
fix: use _comp_compgen for COMPREPLY=($(compgen ... -- "..."))
1 parent 87509ba commit 2a1a9e1

File tree

17 files changed

+33
-33
lines changed

17 files changed

+33
-33
lines changed

completions/7z

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ _comp_cmd_7z()
1515

1616
case $cur in
1717
-ao*)
18-
COMPREPLY=($(compgen -P"${cur:0:3}" -W 'a s t u' -- "${cur:3}"))
18+
_comp_compgen -c "${cur:3}" -- -P"${cur:0:3}" -W 'a s t u'
1919
return
2020
;;
2121
-?(a)[ix]*)
@@ -31,33 +31,33 @@ _comp_cmd_7z()
3131
elif [[ $cur == ?(r@(-|0|))@* ]]; then
3232
local IFS=$' \t\n' reset=$(shopt -po noglob)
3333
set -o noglob
34-
COMPREPLY=($(compgen -P"${opt}${cur%%@*}@" -f -- "${cur#*@}"))
34+
_comp_compgen -c "${cur#*@}" -- -P"${opt}${cur%%@*}@" -f
3535
$reset
3636
compopt -o filenames
3737
fi
3838
return
3939
;;
4040
-mhe=* | -mhc=* | -ms=* | -mt=*)
41-
COMPREPLY=($(compgen -W 'on off' -- "${cur#*=}"))
41+
_comp_compgen -c "${cur#*=}" -- -W 'on off'
4242
return
4343
;;
4444
-mx=*)
45-
COMPREPLY=($(compgen -W '0 1 3 5 7 9' -- "${cur#*=}"))
45+
_comp_compgen -c "${cur#*=}" -- -W '0 1 3 5 7 9'
4646
return
4747
;;
4848
-o* | -w?*)
4949
local reset=$(shopt -po noglob)
5050
set -o noglob
5151
compopt -o filenames
5252
local IFS=$'\n'
53-
COMPREPLY=($(compgen -d -P"${cur:0:2}" -S/ -- "${cur:2}"))
53+
_comp_compgen -c "${cur:2}" -- -d -P"${cur:0:2}" -S/
5454
_comp_unlocal IFS
5555
$reset
5656
compopt -o nospace
5757
return
5858
;;
5959
-r?*)
60-
COMPREPLY=($(compgen -P"${cur:0:2}" -W '- 0' -- "${cur:2}"))
60+
_comp_compgen -c "${cur:2}" -- -P"${cur:0:2}" -W '- 0'
6161
return
6262
;;
6363
-scs*)
@@ -66,7 +66,7 @@ _comp_cmd_7z()
6666
return
6767
;;
6868
-ssc?*)
69-
COMPREPLY=($(compgen -P"${cur:0:4}" -W '-' -- "${cur:4}"))
69+
_comp_compgen -c "${cur:4}" -- -P"${cur:0:4}" -W '-'
7070
return
7171
;;
7272
-t*)

completions/_umount.linux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ _comp_cmd_umount__reply_compgen_array()
2828

2929
# Actually generate completions.
3030
local IFS=$'\n'
31-
COMPREPLY=($(compgen -W "$wlist" -- "${ecur}"))
31+
_comp_compgen -c "${ecur}" -- -W "$wlist"
3232
_comp_unlocal IFS
3333
}
3434

completions/dot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ _comp_cmd_dot()
1515
local langs=($("$1" -TNON_EXISTENT 2>&1 |
1616
command sed -ne 's/.*one of://p'))
1717
((${#langs[@]})) &&
18-
COMPREPLY=($(compgen -P -T -W '"${langs[@]}"' -- "${cur#-T}"))
18+
_comp_compgen -c "${cur#-T}" -- -P -T -W '"${langs[@]}"'
1919
return
2020
;;
2121
-K*)
2222
local layouts=($("$1" -KNON_EXISTENT 2>&1 |
2323
command sed -ne 's/.*one of://p'))
2424
((${#layouts[@]})) &&
25-
COMPREPLY=($(compgen -P -K -W '"${layouts[@]}"' -- "${cur#-K}"))
25+
_comp_compgen -c "${cur#-K}" -- -P -K -W '"${layouts[@]}"'
2626
return
2727
;;
2828
-o*)

completions/fbgs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ _comp_cmd_fbgs()
1818
return
1919
;;
2020
-d | --device)
21-
COMPREPLY=($(compgen -f -d -- "${cur:-/dev/}"))
21+
_comp_compgen -c "${cur:-/dev/}" -- -f -d
2222
return
2323
;;
2424
-fp | --firstpage | -lp | --lastpage | -r | --resolution | -s | --scroll | -t | \

completions/fbi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ _comp_cmd_fbi()
2626
return
2727
;;
2828
-d | --device)
29-
COMPREPLY=($(compgen -f -d -- "${cur:-/dev/}"))
29+
_comp_compgen -c "${cur:-/dev/}" -- -f -d
3030
return
3131
;;
3232
--cachemem | --blend | -T | --vt | -s | --scroll | -t | --timeout | -g | --gamma)

completions/java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ _comp_cmd_java()
160160
case $cur in
161161
# standard option completions
162162
-verbose:*)
163-
COMPREPLY=($(compgen -W 'class gc jni' -- "${cur#*:}"))
163+
_comp_compgen -c "${cur#*:}" -- -W 'class gc jni'
164164
return
165165
;;
166166
-javaagent:*)
@@ -181,7 +181,7 @@ _comp_cmd_java()
181181
return
182182
;;
183183
-Xcheck:*)
184-
COMPREPLY=($(compgen -W 'jni' -- "${cur#*:}"))
184+
_comp_compgen -c "${cur#*:}" -- -W 'jni'
185185
return
186186
;;
187187
-Xgc:*)
@@ -199,7 +199,7 @@ _comp_cmd_java()
199199
return
200200
;;
201201
-Xshare:*)
202-
COMPREPLY=($(compgen -W 'auto off on' -- "${cur#*:}"))
202+
_comp_compgen -c "${cur#*:}" -- -W 'auto off on'
203203
return
204204
;;
205205
-Xverbose:*)
@@ -208,7 +208,7 @@ _comp_cmd_java()
208208
return
209209
;;
210210
-Xverify:*)
211-
COMPREPLY=($(compgen -W 'all none remote' -- "${cur#*:}"))
211+
_comp_compgen -c "${cur#*:}" -- -W 'all none remote'
212212
return
213213
;;
214214
# the rest that we have no completions for
@@ -316,7 +316,7 @@ _comp_cmd_javac()
316316
# the others.
317317
local opts=$("$1" $helpopt 2>&1 | command sed -e 's/-g:none/-g:{none}/' -ne \
318318
"s/^[[:space:]]*${cur%%:*}:{\([^}]\{1,\}\)}.*/\1/p")
319-
COMPREPLY=($(compgen -W "${opts//,/ }" -- "${cur#*:}"))
319+
_comp_compgen -c "${cur#*:}" -- -W "${opts//,/ }"
320320
return
321321
fi
322322

completions/mutt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ _comp_cmd_mutt__filedir()
141141
# Match any file in $folder beginning with $cur
142142
# (minus the leading '=' sign).
143143
compopt -o filenames
144-
COMPREPLY=($(compgen -f -- "$folder/${cur:1}"))
144+
_comp_compgen -c "$folder/${cur:1}" -- -f
145145
COMPREPLY=(${COMPREPLY[@]#$folder/})
146146
return
147147
elif [[ $cur == !* ]]; then

completions/mypy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ _comp_cmd_mypy()
2525
return
2626
;;
2727
--python-executable)
28-
COMPREPLY=($(compgen -c -- "${cur:-py}"))
28+
_comp_compgen -c "${cur:-py}" -- -c
2929
return
3030
;;
3131
--*-dir | --*-report)

completions/perltidy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ _comp_cmd_perltidy()
2121
return
2222
;;
2323
-ole=* | --output-line-ending=*)
24-
COMPREPLY=($(compgen -W 'dos win mac unix' -- "${cur#*=}"))
24+
_comp_compgen -c "${cur#*=}" -- -W 'dos win mac unix'
2525
return
2626
;;
2727
-bt=* | --brace-tightness=* | -pt=* | --paren-tightness=* | \
@@ -35,15 +35,15 @@ _comp_cmd_perltidy()
3535
-cti=* | --closing-token-indentation=* | \
3636
-kbl=* | --keep-old-blank-lines=* | \
3737
-vt=* | --vertical-tightness=*)
38-
COMPREPLY=($(compgen -W '0 1 2' -- "${cur#*=}"))
38+
_comp_compgen -c "${cur#*=}" -- -W '0 1 2'
3939
return
4040
;;
4141
-vtc=* | --vertical-tightness-closing=*)
42-
COMPREPLY=($(compgen -W '0 1' -- "${cur#*=}"))
42+
_comp_compgen -c "${cur#*=}" -- -W '0 1'
4343
return
4444
;;
4545
-cab=* | --comma-arrow-breakpoints=*)
46-
COMPREPLY=($(compgen -W '0 1 2 3' -- "${cur#*=}"))
46+
_comp_compgen -c "${cur#*=}" -- -W '0 1 2 3'
4747
return
4848
;;
4949
-*=)

completions/pkg_delete

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _comp_cmd_pkg_delete()
99

1010
[[ $prev == -o || $prev == -p || $prev == -W ]] && return
1111

12-
COMPREPLY=($(compgen -d -- "$pkgdir$cur"))
12+
_comp_compgen -c "$pkgdir$cur" -- -d
1313
((${#COMPREPLY[@]} == 0)) || COMPREPLY=(${COMPREPLY[@]#$pkgdir})
1414

1515
} &&

0 commit comments

Comments
 (0)