File tree Expand file tree Collapse file tree 13 files changed +33
-21
lines changed Expand file tree Collapse file tree 13 files changed +33
-21
lines changed Original file line number Diff line number Diff line change @@ -1572,8 +1572,8 @@ _comp_compgen_usage()
1572
1572
_comp_compgen_signals ()
1573
1573
{
1574
1574
local -a sigs
1575
- _comp_compgen -v sigs -c " SIG${cur# " ${1-} " } " -- -P " ${1-} " - A signal &&
1576
- _comp_compgen -U sigs set " ${sigs[@]/# ${1-} SIG/ ${1-} } "
1575
+ _comp_compgen -v sigs -c " SIG${cur# " ${1-} " } " -- -A signal &&
1576
+ _comp_compgen -RU sigs -- -P " ${1-} " -W ' "${ sigs[@]# SIG}" '
1577
1577
}
1578
1578
1579
1579
# This function completes on known mac addresses
@@ -2047,9 +2047,8 @@ _comp_compgen_usergroups()
2047
2047
if (( ${# tmp[@]} )) ; then
2048
2048
local _prefix=${cur%%* ([^:])}
2049
2049
_prefix=${_prefix// \\ / }
2050
- local -a _tmp=(" ${tmp[@]/#/ $_prefix } " )
2051
- _comp_unlocal tmp
2052
- _comp_compgen_set " ${_tmp[@]} "
2050
+ _comp_compgen -Rv tmp -- -P " $_prefix " -W ' "${tmp[@]}"'
2051
+ _comp_compgen -U tmp set " ${tmp[@]} "
2053
2052
fi
2054
2053
elif [[ $cur == * :* ]]; then
2055
2054
# Completing group after 'user:gr<TAB>'.
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ _comp_cmd_mount()
25
25
ufs umsdos usbfs vfat xfs'
26
26
_comp_compgen -a fstypes
27
27
[[ $split ]] && (( ${# COMPREPLY[@]} )) &&
28
- COMPREPLY=( $ {COMPREPLY[@]/#/ $prev ,} )
28
+ _comp_compgen -Rv COMPREPLY -- -P " $prev , " -W ' "$ {COMPREPLY[@]}" '
29
29
return
30
30
;;
31
31
--bind | -B | --rbind | -R)
@@ -204,7 +204,7 @@ _comp_cmd_mount()
204
204
# COMP_WORDBREAKS is a real pain in the ass
205
205
prev=" ${prev##* ["$COMP_WORDBREAKS"]} "
206
206
[[ $split ]] && ((${COMPREPLY[@]} )) &&
207
- COMPREPLY=( $ {COMPREPLY[@]/#/ " $prev , " } )
207
+ _comp_compgen -Rv COMPREPLY -- -P " $prev , " -W ' "$ {COMPREPLY[@]}" '
208
208
[[ ${COMPREPLY-} == * = ]] && compopt -o nospace
209
209
return
210
210
;;
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ _comp_cmd_umount()
111
111
usbfs vfat xfs'
112
112
_comp_compgen -a fstypes
113
113
[[ $split ]] && (( ${# COMPREPLY[@]} )) &&
114
- COMPREPLY=( $ {COMPREPLY[@]/#/ $prev ,} )
114
+ _comp_compgen -Rv COMPREPLY -- -P " $prev , " -W ' "$ {COMPREPLY[@]}" '
115
115
return
116
116
;;
117
117
-O)
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ _comp_cmd_chromium_browser()
18
18
* ://* )
19
19
local prefix=" ${cur%%://* } ://"
20
20
_comp_compgen_known_hosts -- " ${cur#*:// } " &&
21
- COMPREPLY=( " $ {COMPREPLY[@]/#/ $prefix } " )
21
+ _comp_compgen -Rv COMPREPLY -- -P " $prefix " -W ' "$ {COMPREPLY[@]}" '
22
22
_comp_ltrim_colon_completions " $cur "
23
23
;;
24
24
* )
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ _comp_cmd_cppcheck()
26
26
_comp_compgen -- -W ' all warning style performance portability
27
27
information unusedFunction missingInclude' &&
28
28
[[ $split ]] &&
29
- COMPREPLY=( $ {COMPREPLY[@]/#/ " $prev , " } )
29
+ _comp_compgen -Rv COMPREPLY -- -P " $prev , " -W ' "$ {COMPREPLY[@]}" '
30
30
return
31
31
;;
32
32
--error-exitcode)
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ _comp_cmd_cvs__entries()
6
6
[[ -e ${prefix-} CVS/Entries ]] || prefix=" "
7
7
entries=($( cut -d/ -f2 -s " ${prefix-} CVS/Entries" 2> /dev/null) )
8
8
if (( ${# entries[@]} )) ; then
9
- entries=( " ${entries[@]/#/ ${prefix-} } " )
9
+ _comp_compgen -Rv entries -- -P " ${prefix-} " -W ' "${ entries[@]}" '
10
10
compopt -o filenames
11
11
fi
12
12
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ _comp_cmd_info()
51
51
52
52
_comp_split -F : infopath " $infopath "
53
53
if (( ${# infopath[@]} )) ; then
54
- infopath=( " $ {infopath[@]/%// $cur * } " )
54
+ _comp_compgen -Rv infopath -- -S " / $cur * " -W ' "$ {infopath[@]}" '
55
55
local IFS=
56
56
_comp_expand_glob COMPREPLY ' ${infopath[@]}'
57
57
_comp_unlocal IFS
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ _comp_cmd_kcov()
33
33
cur=" ${cur##* ,} "
34
34
_comp_compgen -- -W " {0..100}"
35
35
(( ${# COMPREPLY[@]} == 1 )) &&
36
- COMPREPLY=( ${COMPREPLY /#/ $ prev ,} )
36
+ _comp_compgen -Rv COMPREPLY -- -P " $ prev ," -W ' "$COMPREPLY" '
37
37
else
38
38
_comp_compgen -- -W " {0..100}"
39
39
(( ${# COMPREPLY[@]} == 1 )) && COMPREPLY=(" ${COMPREPLY/%/ ,} " )
Original file line number Diff line number Diff line change @@ -76,9 +76,12 @@ _comp_cmd_man()
76
76
77
77
_comp_split -F : manpath " $manpath "
78
78
if (( ${# manpath[@]} )) ; then
79
- manpath=(" ${manpath[@]/%//* man$sect / $cur * } " " ${manpath[@]/%//* cat$sect / $cur * } " )
79
+ local manfiles
80
+ _comp_compgen -Rv manfiles -- -S " /*man$sect /$cur *" -W ' "${manpath[@]}"'
81
+ _comp_compgen -aRv manfiles -- -S " /*cat$sect /$cur *" -W ' "${manpath[@]}"'
82
+
80
83
local IFS=
81
- _comp_expand_glob COMPREPLY ' ${manpath [@]}'
84
+ _comp_expand_glob COMPREPLY ' ${manfiles [@]}'
82
85
_comp_unlocal IFS
83
86
84
87
if (( ${# COMPREPLY[@]} != 0 )) ; then
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ _comp_cmd_povray()
16
16
cur=" ${povcur# [-+]I} " # to confuse _comp_compgen_filedir
17
17
pfx=" ${povcur% " $cur " } "
18
18
_comp_compgen_filedir pov
19
- (( ${# COMPREPLY[@]} )) && COMPREPLY=(" ${COMPREPLY[@]/#/ $pfx } " )
19
+ (( ${# COMPREPLY[@]} )) &&
20
+ _comp_compgen -Rv COMPREPLY -- -P " $pfx " -W ' "${COMPREPLY[@]}"'
20
21
return
21
22
;;
22
23
[-+]O* )
@@ -40,7 +41,8 @@ _comp_cmd_povray()
40
41
cur=" ${povcur# [-+]O} " # to confuse _comp_compgen_filedir
41
42
pfx=" ${povcur% " $cur " } "
42
43
_comp_compgen -a filedir $oext
43
- (( ${# COMPREPLY[@]} )) && COMPREPLY=(" ${COMPREPLY[@]/#/ $pfx } " )
44
+ (( ${# COMPREPLY[@]} )) &&
45
+ _comp_compgen -Rv COMPREPLY -- -P " $pfx " -W ' "${COMPREPLY[@]}"'
44
46
return
45
47
;;
46
48
* .ini\[ | * .ini\[ * [^]]) # sections in .ini files
@@ -50,7 +52,8 @@ _comp_cmd_povray()
50
52
COMPREPLY=($( command sed -ne \
51
53
' s/^[[:space:]]*\[\(' " $cur " ' [^]]*\]\).*$/\1/p' -- " $pfx " ) )
52
54
# to prevent [bar] expand to nothing. can be done more easily?
53
- (( ${# COMPREPLY[@]} )) && COMPREPLY=(" ${COMPREPLY[@]/#/ ${pfx} [} " )
55
+ (( ${# COMPREPLY[@]} )) &&
56
+ _comp_compgen -Rv COMPREPLY -- -P " ${pfx} [" -W ' "${COMPREPLY[@]}"'
54
57
return
55
58
;;
56
59
* )
You can’t perform that action at this time.
0 commit comments