_cd(): sigh, completion on dirs and subdirs of entries in $CDPATH was broken

yet again, this time due to the space having been removed from local $IFS.
  This is fixed now, but there's still a bug remaining, namely that completion
  does not work correctly if dirs or subdirs of entries in $CDPATH contain
  embedded spaces
_longopt(): install completion for {mk,rm}dir as -o filenames, not dirnames
This commit is contained in:
ianmacd 2002-02-22 07:41:05 +00:00
parent 2ae196062c
commit aa73cdba0c

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05a # bash_completion - some programmable completion functions for bash 2.05a
# #
# $Id: bash_completion,v 1.140 2002/02/21 20:26:36 ianmacd Exp $ # $Id: bash_completion,v 1.141 2002/02/22 08:41:05 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -1406,13 +1406,14 @@ _cd()
fi fi
if [ -n "$CDPATH" ]; then if [ -n "$CDPATH" ]; then
# we have a CDPATH, so loop on its contents # we have a CDPATH, so loop on its contents
for i in ${CDPATH//:/ }; do for i in ${CDPATH//:/$'\t'}; do
# create an array of matched subdirs # create an array of matched subdirs
dirs=( $( compgen -d $i/$cur ) ) dirs=( $( compgen -d $i/$cur ) )
# add subdirs to list of completions as necessary # add subdirs to list of completions as necessary
[ ${#dirs[@]} ] && COMPREPLY=( ${COMPREPLY[@]} ${dirs[@]#$i/}) [ ${#dirs[@]} ] && COMPREPLY=( ${COMPREPLY[@]} ${dirs[@]#$i/})
done done
fi fi
IFS=$' \t\n'
COMPREPLY=( ${COMPREPLY[@]} $( compgen -d $cur ) ) COMPREPLY=( ${COMPREPLY[@]} $( compgen -d $cur ) )
return 0 return 0
@ -1765,16 +1766,14 @@ _longopt()
else else
_filedir _filedir
fi fi
unset cmd
} }
complete -F _longopt -o dirnames mkdir rmdir
# makeinfo and texi2dvi are defined elsewhere # makeinfo and texi2dvi are defined elsewhere
for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \ for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
bison cpio diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \ bison cpio diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
touch vdir xargs awk gperf grep gpg grub indent less m4 sed shar date \ touch vdir xargs awk gperf grep gpg grub indent less m4 sed shar date \
env seq su tee uname who texindex cat csplit cut expand fmt fold head \ env seq su tee uname who texindex cat csplit cut expand fmt fold head \
md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \ md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \
uniq wc units wget rsync ldd bash id info irb; do uniq wc units wget rsync ldd bash id info irb mkdir rmdir; do
have $i && complete -F _longopt -o filenames $i have $i && complete -F _longopt -o filenames $i
done done
unset i unset i