fixed bug in _cd that caused no completions to be returned if CDPATH was not
set and user was not trying to complete on an absolute path
This commit is contained in:
parent
bc4dc3b582
commit
9c4807523e
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# <![CDATA[
|
# <![CDATA[
|
||||||
#
|
#
|
||||||
# $Id: bash_completion,v 1.24 2001/08/22 17:20:27 ianmacd Exp $
|
# $Id: bash_completion,v 1.25 2001/09/21 20:51:30 ianmacd Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||||
#
|
#
|
||||||
@ -1236,7 +1236,7 @@ _cd()
|
|||||||
# standard dir completion if parameter contains a /
|
# standard dir completion if parameter contains a /
|
||||||
[[ "$cur" == /* ]] && COMPREPLY=( $( compgen -d $cur ) ) && return 0
|
[[ "$cur" == /* ]] && COMPREPLY=( $( compgen -d $cur ) ) && return 0
|
||||||
|
|
||||||
[ -n "$CDPATH" ] && {
|
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//:/ }; do
|
||||||
# create an array of matched subdirs
|
# create an array of matched subdirs
|
||||||
@ -1244,7 +1244,9 @@ _cd()
|
|||||||
# 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
|
||||||
}
|
else
|
||||||
|
COMPREPLY=( $( compgen -d $cur ) )
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user