- _cd(): completion was failing when CDPATH pointed to directories containing
spaces in their names
This commit is contained in:
parent
6b7dfdf5f0
commit
902a06d374
@ -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.319 2002/05/15 20:56:25 ianmacd Exp $
|
# $Id: bash_completion,v 1.320 2002/05/16 09:05:04 ianmacd Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||||
#
|
#
|
||||||
@ -2009,7 +2009,7 @@ _autorpm()
|
|||||||
#
|
#
|
||||||
_cd()
|
_cd()
|
||||||
{
|
{
|
||||||
local IFS=$'\t\n' cur=${COMP_WORDS[COMP_CWORD]} dirs=() i
|
local IFS=$'\t\n' cur=${COMP_WORDS[COMP_CWORD]} i j k
|
||||||
|
|
||||||
# Use standard dir completion if no CDPATH or parameter starts with /,
|
# Use standard dir completion if no CDPATH or parameter starts with /,
|
||||||
# ./ or ../
|
# ./ or ../
|
||||||
@ -2022,16 +2022,15 @@ _cd()
|
|||||||
# we have a CDPATH, so loop on its contents
|
# we have a CDPATH, so loop on its contents
|
||||||
for i in ${CDPATH//:/$'\t'}; do
|
for i in ${CDPATH//:/$'\t'}; do
|
||||||
# create an array of matched subdirs
|
# create an array of matched subdirs
|
||||||
dirs=( $( compgen -d $i/$cur ) )
|
k=${#COMPREPLY[@]}
|
||||||
# add subdirs to list of completions as necessary
|
for j in $( compgen -d $i/$cur); do
|
||||||
[ ${#dirs[@]} ] && COMPREPLY=( ${COMPREPLY[@]} ${dirs[@]#$i/})
|
COMPREPLY[$k]=${j#$i/}
|
||||||
|
k=$((++k))
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
_filedir -d
|
_filedir -d
|
||||||
|
|
||||||
IFS=$' \t\n'
|
|
||||||
COMPREPLY=( ${COMPREPLY[@]} )
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
complete -F _cd $nospace $filenames cd
|
complete -F _cd $nospace $filenames cd
|
||||||
@ -2561,8 +2560,8 @@ have cardctl &&
|
|||||||
_cardctl()
|
_cardctl()
|
||||||
{
|
{
|
||||||
local cur
|
local cur
|
||||||
COMPREPLY=()
|
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
|
|
||||||
if [ $COMP_CWORD -eq 1 ]; then
|
if [ $COMP_CWORD -eq 1 ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user