File tree Expand file tree Collapse file tree 9 files changed +19
-24
lines changed Expand file tree Collapse file tree 9 files changed +19
-24
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ _comp_cmd_adb()
39
39
_comp_compgen -av tmp help -- help
40
40
fi
41
41
if [[ ! $cur || $cur != -* ]]; then
42
- tmp+=( $( " $1 " help 2>&1 | _comp_awk ' $1 == "adb" { print $2 }' ) )
42
+ _comp_split -a tmp " $( " $1 " help 2>&1 | _comp_awk ' $1 == "adb" { print $2 }' ) "
43
43
tmp+=(devices connect disconnect sideload)
44
44
fi
45
45
(( ${# tmp[@]} )) &&
Original file line number Diff line number Diff line change @@ -103,11 +103,9 @@ _comp_cmd_curl()
103
103
return
104
104
;;
105
105
--help | -${noargopts} h)
106
- local x categories=(
107
- $( " $1 " --help non-existent-category 2>&1 |
108
- _comp_awk ' /^[ \t]/ {print $1}' )
109
- )
110
- if (( ${# categories[@]} )) ; then
106
+ local x categories
107
+ if _comp_split categories " $( " $1 " --help non-existent-category 2>&1 |
108
+ _comp_awk ' /^[ \t]/ {print $1}' ) " ; then
111
109
for x in " ${categories[@]} " ; do
112
110
# Looks like an option? Likely no --help category support
113
111
[[ $x != -* ]] || return
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ _comp_xfunc_cvs_compgen_roots()
38
38
{
39
39
local -a cvsroots=()
40
40
[[ -v CVSROOT ]] && cvsroots=(" $CVSROOT " )
41
- [[ -r ~ /.cvspass ]] && cvsroots+=( $( _comp_awk ' { print $2 }' ~ /.cvspass) )
41
+ [[ -r ~ /.cvspass ]] && _comp_split -a cvsroots " $( _comp_awk ' { print $2 }' ~ /.cvspass) "
42
42
[[ -r CVS/Root ]] && mapfile -tO " ${# cvsroots[@]} " cvsroots < CVS/Root
43
43
(( ${# cvsroots[@]} )) &&
44
44
_comp_compgen -U cvsroots -- -W ' "${cvsroots[@]}"'
Original file line number Diff line number Diff line change @@ -98,9 +98,8 @@ _comp_cmd_fio()
98
98
return
99
99
;;
100
100
--?* )
101
- local IFS=$' \n '
102
- local cmdhelp=($( " $1 " --cmdhelp=" ${prev# --} " 2> /dev/null) )
103
- _comp_unlocal IFS
101
+ local -a cmdhelp
102
+ _comp_split -l cmdhelp " $( " $1 " --cmdhelp=" ${prev# --} " 2> /dev/null) "
104
103
case ${cmdhelp[*]-} in
105
104
* " showing closest match" * )
106
105
# ignore
Original file line number Diff line number Diff line change @@ -12,11 +12,8 @@ _comp_cmd_kldload()
12
12
return
13
13
fi
14
14
15
- local moddirs modules i IFS=" ;"
16
- moddirs=($( kldconfig -r 2> /dev/null) )
17
- _comp_unlocal IFS
18
-
19
- if (( ${# moddirs[@]} )) ; then
15
+ local moddirs modules i
16
+ if _comp_split -F : moddirs " $( kldconfig -r 2> /dev/null) " ; then
20
17
compopt -o filenames
21
18
for i in " ${moddirs[@]} " ; do
22
19
_comp_compgen -v modules -c " $i /$cur " -- -f &&
Original file line number Diff line number Diff line change @@ -57,8 +57,7 @@ _comp_cmd_mplayer()
57
57
;;
58
58
-subcp | -msgcharset)
59
59
local cp
60
- cp=($( iconv --list 2> /dev/null | command sed -e " s@//@@;" 2> /dev/null) )
61
- if (( ${# cp[@]} )) ; then
60
+ if _comp_split cp " $( iconv --list 2> /dev/null | command sed -e " s@//@@;" 2> /dev/null) " ; then
62
61
if [[ $cur == " ${cur,,} " ]]; then
63
62
_comp_compgen -- -W ' "${cp[@],,}"'
64
63
else
@@ -80,7 +79,7 @@ _comp_cmd_mplayer()
80
79
# may want to set the MPLAYER_SKINS_DIR global variable
81
80
local -a dirs
82
81
if [[ $MPLAYER_SKINS_DIR ]]; then
83
- dirs=( $MPLAYER_SKINS_DIR )
82
+ _comp_split dirs " $MPLAYER_SKINS_DIR "
84
83
else
85
84
dirs=(/usr/share/mplayer/skins /usr/local/share/mplayer/skins)
86
85
fi
Original file line number Diff line number Diff line change @@ -66,8 +66,9 @@ _comp_cmd_mutt__get_conffiles__visit()
66
66
visited[$1 ]=set
67
67
conffiles+=(" $1 " )
68
68
69
- local -a newconffiles=($( command sed -n ' s|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' " $1 " ) )
70
- (( ${# newconffiles[@]} )) || return 0
69
+ local -a newconffiles
70
+ _comp_split newconffiles " $( command sed -n ' s|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' " $1 " ) " ||
71
+ return 0
71
72
72
73
local file REPLY
73
74
for file in " ${newconffiles[@]} " ; do
Original file line number Diff line number Diff line change 2
2
3
3
_comp_cmd_screen__sessions ()
4
4
{
5
- local sessions=( $( command screen -ls | command sed -ne \
6
- ' s|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).* ' " $1 " ' .*$|\1|p ' ) )
7
- (( ${ # sessions[@]} == 0 )) && return
5
+ local -a sessions
6
+ _comp_split sessions " $( command screen -ls | command sed -ne \
7
+ ' s|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).* ' " $1 " ' .*$|\1|p ' ) " || return
8
8
if [[ $cur == + ([0-9])? (.* ) ]]; then
9
9
# Complete sessions including pid prefixes
10
10
_comp_compgen -- -W ' "${sessions[@]}"'
Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ _comp_cmd_wget()
54
54
-W ' unix windows nocontrol ascii lowercase uppercase'
55
55
56
56
# +o nospace when no more valid option is possible (= append a space)
57
- local opt_as_arr=(${COMPREPLY[0]// ,/ } )
57
+ local -a opt_as_arr
58
+ _comp_split -F $' , \t\n ' opt_as_arr " ${COMPREPLY[0]} "
58
59
(( ${# opt_as_arr[@]} < 4 )) && compopt -o nospace
59
60
return
60
61
;;
You can’t perform that action at this time.
0 commit comments