File tree Expand file tree Collapse file tree 8 files changed +26
-50
lines changed Expand file tree Collapse file tree 8 files changed +26
-50
lines changed Original file line number Diff line number Diff line change @@ -81,13 +81,15 @@ _comp_cmd_slackpkg()
81
81
_comp_compgen_filedir
82
82
_comp_compgen -a -- -W ' a ap d e f k kde kdei l n t tcl x xap xfce
83
83
y'
84
- COMPREPLY+=($( cut -f 6 -d\ " ${WORKDIR} /pkglist" 2> /dev/null |
85
- command grep " ^$cur " ) )
84
+ _comp_compgen -a split -l -- " $(
85
+ cut -f 6 -d\ " ${WORKDIR} /pkglist" 2> /dev/null
86
+ ) "
86
87
return
87
88
;;
88
89
info)
89
- COMPREPLY=($( cut -f 6 -d\ " ${WORKDIR} /pkglist" 2> /dev/null |
90
- command grep " ^$cur " ) )
90
+ _comp_compgen_split " $(
91
+ cut -f 6 -d\ " ${WORKDIR} /pkglist" 2> /dev/null
92
+ ) "
91
93
return
92
94
;;
93
95
update)
Original file line number Diff line number Diff line change @@ -52,9 +52,8 @@ _comp_cmd_aptitude()
52
52
return
53
53
;;
54
54
--target-release | --default-release | -${noargopts} t)
55
- COMPREPLY=($( apt-cache policy |
56
- command grep " release.o=Debian,a=$cur " |
57
- command sed -e " s/.*a=\([_[:alnum:]]*\).*/\1/" | uniq 2> /dev/null) )
55
+ _comp_compgen_split -l -- " $( apt-cache policy |
56
+ command sed -ne ' s/.*release.o=Debian,a=\([_[:alnum:]]*\).*/\1/p' ) "
58
57
return
59
58
;;
60
59
esac
Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ _comp_cmd_isql()
7
7
_comp_initialize -- " $@ " || return
8
8
9
9
[[ -f ${ODBCINI-} ]] &&
10
- COMPREPLY=($( command grep " \[$cur " " $ODBCINI " | tr -d \[\] ) )
10
+ _comp_compgen_split -l -- " $(
11
+ command sed -n ' s/\]//g;s/^\[//gp' " $ODBCINI "
12
+ ) "
11
13
} &&
12
14
complete -F _comp_cmd_isql isql
13
15
Original file line number Diff line number Diff line change @@ -22,13 +22,8 @@ _comp_cmd_postcat()
22
22
[[ $idx == -q ]] && qfile=set && break
23
23
done
24
24
if [[ $qfile ]]; then
25
- local len=${# cur} pval
26
- for pval in $( mailq 2> /dev/null |
27
- command sed -e ' 1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ) ; do
28
- if [[ $cur == " ${pval: 0: len} " ]]; then
29
- COMPREPLY+=(" $pval " )
30
- fi
31
- done
25
+ _comp_compgen_split -- " $( mailq 2> /dev/null |
26
+ command sed -e ' 1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ) "
32
27
return
33
28
fi
34
29
Original file line number Diff line number Diff line change @@ -5,42 +5,25 @@ _comp_cmd_postsuper()
5
5
local cur prev words cword comp_args
6
6
_comp_initialize -- " $@ " || return
7
7
8
- local pval len
9
-
10
8
case $prev in
11
9
-c)
12
10
_comp_compgen_filedir -d
13
11
return
14
12
;;
15
13
-[dr])
16
- len=${# cur}
17
- for pval in ALL $( mailq 2> /dev/null |
18
- command sed -e ' 1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ) ; do
19
- if [[ $cur == " ${pval: 0: len} " ]]; then
20
- COMPREPLY+=($pval )
21
- fi
22
- done
14
+ _comp_compgen_split -- " ALL $( mailq 2> /dev/null |
15
+ command sed -e ' 1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* !].*$//' ) "
23
16
return
24
17
;;
25
18
-h)
26
- len=${# cur}
27
- for pval in ALL $( mailq 2> /dev/null |
19
+ _comp_compgen_split -- " ALL $( mailq 2> /dev/null |
28
20
command sed \
29
- -e ' 1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d' ) ; do
30
- if [[ $cur == " ${pval: 0: len} " ]]; then
31
- COMPREPLY+=($pval )
32
- fi
33
- done
21
+ -e ' 1d; $d; /^[^0-9A-Z]/d; /^$/d; s/[* ].*$//; /!$/d' ) "
34
22
return
35
23
;;
36
24
-H)
37
- len=${# cur}
38
- for pval in ALL $( mailq 2> /dev/null | command sed -e \
39
- ' 1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ) ; do
40
- if [[ $cur == " ${pval: 0: len} " ]]; then
41
- COMPREPLY+=($pval )
42
- fi
43
- done
25
+ _comp_compgen_split -- " ALL $( mailq 2> /dev/null | command sed \
26
+ -e ' 1d; $d; /^[^0-9A-Z]/d; /^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ) "
44
27
return
45
28
;;
46
29
esac
Original file line number Diff line number Diff line change @@ -51,10 +51,9 @@ _comp_cmd_povray()
51
51
cur=" ${povcur#* \[ } "
52
52
pfx=" ${povcur% \[ " $cur " } " # prefix == filename
53
53
[[ -f $pfx && -r $pfx ]] || return
54
- COMPREPLY=($( command sed -ne \
55
- ' s/^[[:space:]]*\[\(' " $cur " ' [^]]*\]\).*$/\1/p' -- " $pfx " ) )
56
- # to prevent [bar] expand to nothing. can be done more easily?
57
- (( ${# COMPREPLY[@]} )) &&
54
+ _comp_compgen_split -l -- " $( command sed -ne \
55
+ ' s/^[[:space:]]*\[\([^]]*\]\).*$/\1/p' -- " $pfx " ) " &&
56
+ # to prevent [bar] expand to nothing. can be done more easily?
58
57
_comp_compgen -Rv COMPREPLY -- -P " ${pfx} [" -W ' "${COMPREPLY[@]}"'
59
58
return
60
59
;;
Original file line number Diff line number Diff line change @@ -61,10 +61,8 @@ _comp_cmd_sbopkg()
61
61
local file=${REPO_ROOT-} /${REPO_NAME-} /${REPO_BRANCH-} /SLACKBUILDS.TXT
62
62
[[ -f $file && -r $file ]] || return
63
63
64
- COMPREPLY=($(
65
- command sed -ne " /^SLACKBUILD NAME: $cur /{s/^SLACKBUILD NAME: //;p;}" \
66
- " $file "
67
- ) )
64
+ _comp_compgen_split -l -- " $( command sed -ne " s/^SLACKBUILD NAME: //p" \
65
+ " $file " ) "
68
66
_comp_compgen -aC " $QUEUEDIR " -- -f -X " !*.sqf"
69
67
} &&
70
68
complete -F _comp_cmd_sbopkg sbopkg
Original file line number Diff line number Diff line change @@ -33,10 +33,8 @@ _comp_cmd_wvdial()
33
33
done
34
34
# parse config files for sections and
35
35
# remove default section
36
- COMPREPLY=($(
37
- command sed -ne " s|^\[Dialer \($cur .*\)\]$|\1|p" " $config " \
38
- 2> /dev/null | command grep -v ' ^Defaults$'
39
- ) )
36
+ _comp_compgen_split -l -X ' Defaults' -- " $( command sed -ne \
37
+ ' s/^\[Dialer \(.*\)\]$/\1/p' " $config " 2> /dev/null) "
40
38
# escape spaces
41
39
COMPREPLY=(" ${COMPREPLY[@]// / \\ } " )
42
40
;;
You can’t perform that action at this time.
0 commit comments