1
diff -u bash-completion-20060301/debian/changelog bash-completion-20060301/debian/changelog
2
--- bash-completion-20060301/debian/changelog
3
+++ bash-completion-20060301/debian/changelog
5
+bash-completion (20060301-3ubuntu2) hardy; urgency=low
8
+ - Fix _get_cword more
9
+ - Fix _command function to correctly prune the command line (LP: #103395)
10
+ - Remove newline from options pattern for dpkg (LP: #138312)
11
+ - Start readline-quoting arguments to compgen (LP: #123665)
12
+ - Save and restore -v shell option (LP: #205444)
13
+ - Prevent glob expansion in _filedir function (LP: #194419)
14
+ - Quote glob expression in tar completion function (LP: #194419)
15
+ - Complete AAS/SSA files for mplayer -sub (LP: #151086)
16
+ - Disable completion of postgresql users and databases (LP: #164772)
17
+ - Use files from UserKnownHostsFile options in addition to standard ones
20
+ -- Mika Fischer <mika.fischer@zoopnet.de> Sat, 05 Apr 2008 16:09:34 +0200
22
bash-completion (20060301-3ubuntu1) hardy; urgency=low
24
* Bug fix upload (LP: #194860)
25
diff -u bash-completion-20060301/bash_completion bash-completion-20060301/bash_completion
26
--- bash-completion-20060301/bash_completion
27
+++ bash-completion-20060301/bash_completion
32
-[ -n "${BASH_COMPLETION_DEBUG:-}" ] && set -v || set +v
33
+if [[ $- == *v* ]]; then
34
+ BASH_COMPLETION_ORIGINAL_V_VALUE="-v"
36
+ BASH_COMPLETION_ORIGINAL_V_VALUE="+v"
39
+if [[ -n $BASH_COMPLETION_DEBUG ]]; then
45
# Alter the following to reflect the location of this file.
48
[[ "$( bind -v )" = *$1+([[:space:]])on* ]]
51
+# This function shell-quotes the argument
54
+ echo \'${1//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
57
+# This function quotes the argument in a way so that readline dequoting
58
+# results in the original argument
61
+ local t="${1//\\/\\\\}"
62
+ echo \'${t//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
65
+# This function shell-dequotes the argument
72
# Get the word to complete
73
# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
74
# where the user is completing in the middle of a word.
75
# (For example, if the line is "ls foobar",
76
# and the cursor is here --------> ^
77
# it will complete just "foo", not "foobar", which is what the user wants.)
79
-# Accepts an optional parameter indicating which characters out of
80
-# $COMP_WORDBREAKS should NOT be considered word breaks. This is useful
81
-# for things like scp where we want to return host:path and not only path.
85
- local WORDBREAKS=${COMP_WORDBREAKS}
87
- for (( i=0; i<${#1}; ++i )); do
88
- local char=${1:$i:1}
89
- WORDBREAKS=${WORDBREAKS//$char/}
90
+ if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
91
+ echo "${COMP_WORDS[COMP_CWORD]}"
94
+ local cur="$COMP_LINE"
95
+ local index="$COMP_POINT"
96
+ for (( i = 0; i <= COMP_CWORD; ++i )); do
97
+ while [[ "${#cur}" -ge ${#COMP_WORDS[i]} ]] && [[ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}" ]]; do
99
+ index="$(( index - 1 ))"
101
+ if [[ "$i" -lt "$COMP_CWORD" ]]; then
102
+ local old_size="${#cur}"
103
+ cur="${cur#${COMP_WORDS[i]}}"
104
+ local new_size="${#cur}"
105
+ index="$(( index - old_size + new_size ))"
109
- local cur=${COMP_LINE:0:$COMP_POINT}
111
- local word_start=`expr "$tmp" : '.*['"${WORDBREAKS}"']'`
112
- while [ "$word_start" -ge 2 ]; do
113
- local char=${cur:$(( $word_start - 2 )):1}
114
- if [ "$char" != "\\" ]; then
117
- tmp=${COMP_LINE:0:$(( $word_start - 2 ))}
118
- word_start=`expr "$tmp" : '.*['"${WORDBREAKS}"']'`
121
- cur=${cur:$word_start}
123
+ if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
124
+ # We messed up! At least return the whole word so things keep working
125
+ echo "${COMP_WORDS[COMP_CWORD]}"
127
+ echo "${cur:0:$index}"
133
@@ -221,23 +252,23 @@
137
- local IFS=$'\t\n' xspec #glob
138
+ local IFS=$'\t\n' xspec
142
- #glob=$(set +o|grep noglob) # save glob setting.
143
- #set -f # disable pathname expansion (globbing)
145
- if [ "${1:-}" = -d ]; then
146
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d -- $cur ) )
147
- #eval "$glob" # restore glob setting.
150
+ while read -r tmp; do
151
+ [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
152
+ done < <( compgen -d -- "$(quote_readline "$cur")" )
154
+ if [[ "$1" != -d ]]; then
155
+ xspec=${1:+"!*.$1"}
156
+ while read -r tmp; do
157
+ [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
158
+ done < <( compgen -f -X "$xspec" -- "$(quote_readline "$cur")" )
161
- xspec=${1:+"!*.$1"} # set only if glob passed in as $1
162
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -f -X "$xspec" -- "$cur" ) \
163
- $( compgen -d -- "$cur" ) )
164
- #eval "$glob" # restore glob setting.
165
+ COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
168
# This function completes on signal names
169
@@ -306,12 +337,12 @@
173
- [ "$cur" != "${cur%\\}" ] && cur="$cur\\"
174
+ # FIXME: Why was this here?
175
+ # [ "$cur" != "${cur%\\}" ] && cur="$cur\\"
177
# expand ~username type directory specifications
178
if [[ "$cur" == \~*/* ]]; then
181
elif [[ "$cur" == \~* ]]; then
183
COMPREPLY=( $( compgen -P '~' -u $cur ) )
185
COMPREPLY=( $( builtin echo $sysvdir/!(*.rpmsave|*.rpmorig|*~|functions)) )
187
if [ -d $famdir ]; then
188
- COMPREPLY=( ${COMPREPLY[@]} $( builtin echo $famdir/!(*.rpmsave|*.rpmorig|*~)) )
189
+ COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpmsave|*.rpmorig|*~)) )
192
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- $cur ) )
193
@@ -1041,7 +1072,7 @@
194
# remove word from list of completions
195
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
197
- echo ${COMPREPLY[@]})
198
+ echo "${COMPREPLY[@]}")
202
@@ -1070,7 +1101,7 @@
204
COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
205
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
206
- COMPREPLY=( ${COMPREPLY[@]:-} \
207
+ COMPREPLY=( "${COMPREPLY[@]}" \
208
$( iwlist ${COMP_WORDS[1]} scan | \
209
awk -F '"' '/ESSID/ {print $2}' | \
211
@@ -1097,7 +1128,7 @@
213
COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
214
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
215
- COMPREPLY=( ${COMPREPLY[@]:-} \
216
+ COMPREPLY=( "${COMPREPLY[@]}" \
217
$( iwlist ${COMP_WORDS[1]} scan | \
218
awk -F ': ' '/Address/ {print $2}' | \
220
@@ -1106,7 +1137,7 @@
223
COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) )
224
- COMPREPLY=( ${COMPREPLY[@]:-} \
225
+ COMPREPLY=( "${COMPREPLY[@]}" \
226
$( iwlist ${COMP_WORDS[1]} rate | \
227
awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \
229
@@ -1391,7 +1422,7 @@
233
- for idx in ${COMP_WORDS[@]}; do
234
+ for idx in "${COMP_WORDS[@]}"; do
235
[[ "$idx" = -q ]] && qfile=1 && break
237
if [[ $qfile == 1 ]]; then
238
@@ -1535,7 +1566,7 @@
242
- for i in ${COMP_WORDS[@]}; do
243
+ for i in "${COMP_WORDS[@]}"; do
244
[ $count -eq $COMP_CWORD ] && break
245
# Last parameter was the CVSROOT, now go back to mode selection
246
if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
247
@@ -1605,7 +1636,7 @@
250
elif [[ "$i" = -* ]]; then
251
- flags=( ${flags[@]:-} $i )
252
+ flags=( "${flags[@]}" $i )
256
@@ -1619,7 +1650,7 @@
258
files=$( command ls -Ad !(CVS) ) || \
259
files=$( command ls -d ${cur}* 2>/dev/null )
260
- for i in ${entries[@]:-}; do
261
+ for i in "${entries[@]}"; do
262
files=( ${files[@]/#$i//} )
264
COMPREPLY=( $( compgen -W '${files[@]}' -- \
265
@@ -1713,8 +1744,8 @@
266
if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
268
# find out what files are missing
269
- for i in ${entries[@]}; do
270
- [ ! -r "$i" ] && miss=( ${miss[@]:-} $i )
271
+ for i in "${entries[@]}"; do
272
+ [ ! -r "$i" ] && miss=( "${miss[@]}" $i )
274
COMPREPLY=( $(compgen -W '${miss[@]:-}' -- $cur) )
276
@@ -1805,7 +1836,7 @@
277
COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat '%{group}\n' | \
279
# backslash escape spaces and translate newlines to tabs
280
- COMPREPLY=( $( echo ${COMPREPLY[@]} | sed 's/ /\\ /g' | tr '\n' '\t' ) )
281
+ COMPREPLY=( $( echo "${COMPREPLY[@]}" | sed 's/ /\\ /g' | tr '\n' '\t' ) )
285
@@ -2476,33 +2507,29 @@
286
user_kh=$( eval echo $( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
289
- # choose which global known hosts file to use
290
- if [ -r "$global_kh" ]; then
291
- kh=( "$global_kh" )
293
- [ -r /etc/ssh/ssh_known_hosts ] &&
294
- kh=( ${kh[@]} /etc/ssh/ssh_known_hosts )
295
- [ -r /etc/ssh/ssh_known_hosts2 ] &&
296
- kh=( ${kh[@]} /etc/ssh/ssh_known_hosts2 )
297
- [ -r /etc/known_hosts ] &&
298
- kh=( ${kh[@]} /etc/known_hosts )
299
- [ -r /etc/known_hosts2 ] &&
300
- kh=( ${kh[@]} /etc/known_hosts2 )
301
- [ -d /etc/ssh2/knownhosts ] &&
302
- khd=( ${khd[@]} /etc/ssh2/knownhosts/*pub )
305
- # choose which user known hosts file to use
306
- if [ -r "$user_kh" ]; then
307
- kh=( ${kh[@]} "$user_kh" )
309
- [ -r ~/.ssh/known_hosts ] &&
310
- kh=( ${kh[@]} ~/.ssh/known_hosts )
311
- [ -r ~/.ssh/known_hosts2 ] &&
312
- kh=( ${kh[@]} ~/.ssh/known_hosts2 )
313
- [ -d ~/.ssh2/hostkeys ] &&
314
- khd=( ${khd[@]} ~/.ssh2/hostkeys/*pub )
316
+ # Global known_hosts files
317
+ [ -r "$global_kh" ] &&
318
+ kh=( "${kh[@]}" "$global_kh" )
319
+ [ -r /etc/ssh/ssh_known_hosts ] &&
320
+ kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
321
+ [ -r /etc/ssh/ssh_known_hosts2 ] &&
322
+ kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 )
323
+ [ -r /etc/known_hosts ] &&
324
+ kh=( "${kh[@]}" /etc/known_hosts )
325
+ [ -r /etc/known_hosts2 ] &&
326
+ kh=( "${kh[@]}" /etc/known_hosts2 )
327
+ [ -d /etc/ssh2/knownhosts ] &&
328
+ khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
330
+ # User known_hosts files
331
+ [ -r "$user_kh" ] &&
332
+ kh=( "${kh[@]}" "$user_kh" )
333
+ [ -r ~/.ssh/known_hosts ] &&
334
+ kh=( "${kh[@]}" ~/.ssh/known_hosts )
335
+ [ -r ~/.ssh/known_hosts2 ] &&
336
+ kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
337
+ [ -d ~/.ssh2/hostkeys ] &&
338
+ khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
340
# If we have known_hosts files to use
341
if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 ]; then
342
@@ -2532,18 +2559,18 @@
343
/^[^|]/ {for (i=1; i<=2; ++i) { \
344
gsub(" .*$", "", $i); \
345
if ($i ~ /'$cur'/) {print $i} \
346
- }}' ${kh[@]} 2>/dev/null ) )
347
+ }}' "${kh[@]}" 2>/dev/null ) )
349
if [ ${#khd[@]} -gt 0 ]; then
350
# Needs to look for files called
351
# .../.ssh2/key_22_<hostname>.pub
352
# dont fork any processes, because in a cluster environment,
353
# there can be hundreds of hostkeys
354
- for i in ${khd[@]} ; do
355
+ for i in "${khd[@]}" ; do
356
if [[ "$i" == *key_22_$curd*.pub ]] && [ -r "$i" ] ; then
359
- COMPREPLY=( ${COMPREPLY[@]} $host )
360
+ COMPREPLY=( "${COMPREPLY[@]}" $host )
364
@@ -2552,11 +2579,11 @@
365
if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
366
local host_aliases=$( sed -ne 's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^*?]*\)$/\2/p' "${config[@]}" )
367
hosts=$( compgen -W "$host_aliases" -- $ocur )
368
- COMPREPLY=( ${COMPREPLY[@]} $hosts )
369
+ COMPREPLY=( "${COMPREPLY[@]}" $hosts )
372
# Now add results of normal hostname completion
373
- COMPREPLY=( ${COMPREPLY[@]} $( compgen -A hostname -- $ocur ) )
374
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -- $ocur ) )
377
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
378
@@ -2599,7 +2626,7 @@
381
[ $COMP_CWORD -eq 1 ] || \
382
- COMPREPLY=( ${COMPREPLY[@]} $( compgen -c -- $cur ) )
383
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
387
@@ -2613,7 +2640,7 @@
388
local cur userhost path
391
- cur=`_get_cword ":"`
396
@@ -2640,7 +2667,7 @@
398
[[ "$cur" == */* ]] || _known_hosts -c -a
400
- COMPREPLY=( ${COMPREPLY[@]} $( command ls -aF1d $cur* \
401
+ COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* \
403
-e "s/[][(){}<>\",:;^&!$&=?\`|\\ ']/\\\\&/g" \
404
-e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
405
@@ -2772,7 +2799,7 @@
406
# remove word from list of completions
407
COMPREPLY=( ${COMPREPLY/ $i / } )
409
- echo ${COMPREPLY[@]})
410
+ echo "${COMPREPLY[@]}")
414
@@ -2931,7 +2958,7 @@
417
# file completion on relevant files
423
@@ -3103,7 +3130,7 @@
424
# we have a CDPATH, so loop on its contents
425
for i in ${CDPATH//:/$'\t'}; do
426
# create an array of matched subdirs
428
+ k="${#COMPREPLY[@]}"
429
for j in $( compgen -d $i/$cur ); do
430
if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
432
@@ -3129,6 +3156,37 @@
433
complete -F _cd $nospace $filenames cd
438
+ if [[ COMP_CWORD -eq 0 ]]; then
440
+ elif [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
441
+ local old_cw0="${COMP_WORDS[0]}"
442
+ local new_cw0="${COMP_WORDS[1]}"
443
+ local old_length="${#COMP_LINE}"
444
+ COMP_LINE=${COMP_LINE#${old_cw0}}
445
+ local head=${COMP_LINE:0:${#new_cw0}}
447
+ while [[ $head != $new_cw0 ]]; do
448
+ COMP_LINE=${COMP_LINE:1}
449
+ head=${COMP_LINE:0:${#new_cw0}}
450
+ if (( ++i > 10 )); then
454
+ local new_length="${#COMP_LINE}"
455
+ COMP_POINT=$(( COMP_POINT + new_length - old_length))
457
+ COMP_CWORD=$(( COMP_CWORD - 1 ))
458
+ for (( i=0; i < ${#COMP_WORDS[@]} - 1; ++i )); do
459
+ COMP_WORDS[i]="${COMP_WORDS[i+1]}"
461
+ unset COMP_WORDS[${#COMP_WORDS[@]}-1]
467
# A meta-command completion function for commands like sudo(8), which need to
468
# first complete on a command, then complete according to that command's own
469
# completion definition - currently not quite foolproof (e.g. mount and umount
470
@@ -3139,63 +3197,45 @@
471
local cur func cline cspec noglob cmd done i \
472
_COMMAND_FUNC _COMMAND_FUNC_ARGS
477
# If the the first arguments following our meta-command-invoker are
478
# switches, get rid of them. Most definitely not foolproof.
480
while [ -z $done ] ; do
481
- cmd=${COMP_WORDS[1]}
482
- if [[ "$cmd" == -* ]] && [ $COMP_CWORD -gt 1 ]; then
483
- for (( i=1 ; i<COMP_CWORD ; i++)) ; do
484
- COMP_WORDS[i]=${COMP_WORDS[i+1]}
486
- COMP_CWORD=$(($COMP_CWORD-1))
487
+ cmd=${COMP_WORDS[0]}
488
+ if [[ "$cmd" == -* ]] && [ $COMP_CWORD -ge 1 ]; then
490
+ elif [[ "$cmd" == -* ]] && [[ $COMP_CWORD -eq 0 ]]; then
497
- if [ $COMP_CWORD -eq 1 ]; then
498
+ if [ $COMP_CWORD -eq 0 ]; then
499
COMPREPLY=( $( compgen -c -- $cur ) )
500
elif complete -p $cmd &>/dev/null; then
501
cspec=$( complete -p $cmd )
502
if [ "${cspec#* -F }" != "$cspec" ]; then
503
- # complete -F <function>
505
# COMP_CWORD and COMP_WORDS() are not read-only,
506
# so we can set them before handing off to regular
509
- # set current token number to 1 less than now
510
- COMP_CWORD=$(( $COMP_CWORD - 1 ))
515
- # get current command line minus initial command
516
- cline="${COMP_LINE#*( )$1 }"
517
- # save noglob state
518
- shopt -qo noglob; noglob=$?
519
- # turn on noglob, as things like 'sudo ls *<Tab>'
520
- # don't work otherwise
522
- # split current command line tokens into array
523
- COMP_WORDS=( $cline )
524
- # reset noglob if necessary
525
- [ $noglob -eq 1 ] && shopt -uo noglob
527
- # This is needed in case user finished entering
528
- # command and pressed tab (e.g. sudo ls <Tab>)
529
- COMP_CWORD=$(( $COMP_CWORD > 0 ? $COMP_CWORD : 1 ))
531
- _COMMAND_FUNC=$func
532
- _COMMAND_FUNC_ARGS=( $cmd $2 $3 )
534
- COMP_POINT=$(( ${COMP_POINT} - ${#1} - 1 ))
537
+ if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
538
+ $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"
540
+ $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
543
# remove any \: generated by a command that doesn't
544
# default to filenames or dirnames (e.g. sudo chown)
545
+ # FIXME: I'm pretty sure this does not work!
546
if [ "${cspec#*-o }" != "$cspec" ]; then
549
@@ -3312,7 +3352,7 @@
550
COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
551
-v -V -w' -- $cur ) )
553
- COMPREPLY=( ${COMPREPLY[@]} \
554
+ COMPREPLY=( "${COMPREPLY[@]}" \
555
$( compgen -W 'create drop extended-status flush-hosts \
556
flush-logs flush-status flush-tables \
557
flush-threads flush-privileges kill \
558
@@ -4010,6 +4050,7 @@
563
COMPREPLY=( $( psql -l 2>/dev/null | \
564
sed -e '1,/^-/d' -e '/^(/,$d' | \
565
awk '{print $1}' | grep "^$cur" ) )
566
@@ -4017,9 +4058,10 @@
570
- COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
572
- [ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- $cur ) )
573
+ #COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
574
+ # grep "^ $cur" ) )
575
+ #[ ${#COMPREPLY[@]} -eq 0 ] &&
576
+ COMPREPLY=( $( compgen -u -- $cur ) )
579
# createdb(1) completion
580
@@ -4276,8 +4318,7 @@
584
- -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info| \
585
- fsys-tarfile|field|control|extract)))
586
+ -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
590
@@ -4597,17 +4638,17 @@
591
for i in ${classpath//:/ }; do
592
if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
593
if type zipinfo &> /dev/null; then
594
- COMPREPLY=( ${COMPREPLY[@]} $( zipinfo -1 \
595
+ COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
596
"$i" | grep "^$cur" | grep '\.class$' | \
599
- COMPREPLY=( ${COMPREPLY[@]} $( jar tf "$i" \
600
+ COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
601
"$cur" | grep "\.class$" | grep -v "\\$" ) )
606
- COMPREPLY=( ${COMPREPLY[@]} $( find "$i" -type f \
607
+ COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
608
-path "$i/$cur*.class" 2>/dev/null | \
609
grep -v "\\$" | sed -e "s|^$i/||" ) )
611
@@ -4632,12 +4673,12 @@
612
# parse each sourcepath element for packages
613
for i in ${sourcepath//:/ }; do
615
- COMPREPLY=( ${COMPREPLY[@]} $( command ls -F -d \
616
+ COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
617
$i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
621
- COMPREPLY=( $( echo ${COMPREPLY[@]} | tr " " "\n" | grep "/$" ) )
622
+ COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
623
# remove packages extension
624
COMPREPLY=( ${COMPREPLY[@]%/} )
625
# convert path syntax to package syntax
626
@@ -4821,7 +4862,7 @@
629
newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) )
630
- for file in ${newconffiles[@]}; do
631
+ for file in "${newconffiles[@]}"; do
632
[[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
635
@@ -4844,8 +4885,8 @@
637
conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
638
aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \
639
- $(eval echo ${conffiles[@]}) ) )
640
- COMPREPLY=( ${COMPREPLY[@]} $( compgen -W "${aliases[*]}" -- $cur ) )
641
+ $(eval echo "${conffiles[@]}") ) )
642
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- $cur ) )
646
@@ -4864,7 +4905,7 @@
647
sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) )
650
- COMPREPLY=( ${COMPREPLY[@]} $( compgen -W "${queryresults[*]}" \
651
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
655
@@ -5320,7 +5361,7 @@
659
- COMPREPLY=( ${COMPREPLY[@]} $( compgen -W '$( PAGER=cat man perl 2>/dev/null | sed -ne "/perl.*Perl overview/,/perlwin32/s/^[^a-z0-9]*\([a-z0-9]*\).*$/\1/p")' -- $cur ) )
660
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=cat man perl 2>/dev/null | sed -ne "/perl.*Perl overview/,/perlwin32/s/^[^a-z0-9]*\([a-z0-9]*\).*$/\1/p")' -- $cur ) )
664
@@ -5550,7 +5591,7 @@
665
COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
667
COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
668
- COMPREPLY=( ${COMPREPLY[@]} ${COMPREPLY2[@]} )
669
+ COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
673
@@ -5654,13 +5695,13 @@
677
- _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js)'
678
+ _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|aas|AAS)'
682
_filedir '@(idx|IDX|ifo|IFO|sub|SUB)'
684
- COMPREPLY=( $( for i in ${COMPREPLY[@]}; do
685
+ COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
686
if [ -f $i -a -r $i ]; then
689
@@ -5897,7 +5938,7 @@
690
-bps -oldpp -nozoom -noflip -nounicode \
692
# add mplayer specific options
693
- [[ "$cmd" == @(?(g)mplayer) ]] && COMPREPLY=( ${COMPREPLY[@]} \
694
+ [[ "$cmd" == @(?(g)mplayer) ]] && COMPREPLY=( "${COMPREPLY[@]}" \
695
$(compgen -W '-autoq -autosync -benchmark \
696
-framedrop -h -help -hardframedrop \
697
-identify -input -lircconf -loop \
698
@@ -5928,7 +5969,7 @@
699
-aaosdcolor -aasubcolor -aadriver \
700
-aaextended -aaeight' -- $cur) )
701
# add mencoder specific options
702
- [[ "$cmd" = mencoder ]] && COMPREPLY=( ${COMPREPLY[@]} \
703
+ [[ "$cmd" = mencoder ]] && COMPREPLY=( "${COMPREPLY[@]}" \
704
$(compgen -W '-audio-density -audio-delay \
705
-audio-preload -divx4opts -endpos \
706
-ffourcc -include -info -lameopts \
707
@@ -6036,7 +6077,7 @@
709
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
710
if [ -e ~/.gnupg/gpg.conf ]; then
711
- COMPREPLY=( ${COMPREPLY[@]} $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur") )
712
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur") )
716
@@ -6216,10 +6257,10 @@
717
# files are always eligible completion
719
# track options are always available
720
- COMPREPLY=( ${COMPREPLY[@]} $( compgen -W '${track_options[@]}' -- $cur ) )
721
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- $cur ) )
722
# general options are no more available after file or track option
723
if [ $track_mode -eq 0 ]; then
724
- COMPREPLY=( ${COMPREPLY[@]} \
725
+ COMPREPLY=( "${COMPREPLY[@]}" \
726
$( compgen -W '${generic_options[@]}' -- $cur ) )
729
@@ -6948,7 +6989,7 @@
733
-complete -F _aspell $default aspell
734
+complete -F _aspell $filenames aspell
738
@@ -9299,9 +9340,17 @@
742
- COMPREPLY=( $( eval compgen -f -X "$xspec" -- \
743
- \"${cur#[\`\"\']}\" 2>/dev/null ) \
744
- $( compgen -d -- $cur ) )
747
+ while read -r tmp; do
748
+ [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
749
+ done < <( compgen -d -- "$(quote_readline "$cur")" )
751
+ while read -r tmp; do
752
+ [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
753
+ done < <( eval compgen -f -X $xspec -- "\$(quote_readline "\$cur")" )
755
+ COMPREPLY=( "${toks[@]}" )
757
list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \
759
@@ -9314,16 +9363,16 @@
760
line=${line%# START exclude*}
761
line=${line%# FINISH exclude*}
763
- list=( ${list[@]:-} $line )
764
+ list=( "${list[@]}" $line )
770
# remove previous compspecs
771
if [ ${#list[@]} -gt 0 ]; then
772
eval complete -r ${list[@]}
773
# install new compspecs
774
- eval complete -F _filedir_xspec $filenames ${list[@]}
775
+ eval complete -F _filedir_xspec $filenames "${list[@]}"
779
@@ -9344,6 +9393,9 @@
780
unset UNAME RELEASE default dirnames filenames have nospace bashdefault \
783
+set $BASH_COMPLETION_ORIGINAL_V_VALUE
784
+unset BASH_COMPLETION_ORIGINAL_V_VALUE
787
### mode: shell-script