Skip to content

Commit

Permalink
re-comment cd completion code.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Oct 27, 2010
1 parent 976c1a8 commit 5b509a9
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions scripts/cd
Expand Up @@ -45,41 +45,46 @@ if [[ ${rvm_project_rvmrc:-1} -ne 0 ]] ; then
return $result
}

_rvm_cd_complete ()
{
local directory current matches item index
#
# Can someone please explain to me what this was meant to accomplish?
# telemachus was encountering issues when he had CDPATH set.
# Namely comletion stopped working.
#
# _rvm_cd_complete ()
# {
# local directory current matches item index

COMPREPLY=()
# COMPREPLY=()

current="${COMP_WORDS[COMP_CWORD]}"
# current="${COMP_WORDS[COMP_CWORD]}"

if [[ -n "$CDPATH" ]] ; then
# if [[ -n "$CDPATH" ]] ; then

index=${#COMPREPLY[@]}
# index=${#COMPREPLY[@]}

for directory in $(printf "$CDPATH" | tr -s ':' ' ') ; do
# for directory in $(printf "$CDPATH" | tr -s ':' ' ') ; do

for item in $( compgen -d "$directory/$current" ) ; do
# for item in $( compgen -d "$directory/$current" ) ; do

item="${item}/"
# item="${item}/"

COMPREPLY[index++]=${item#$directory/}
# COMPREPLY[index++]=${item#$directory/}

done
# done

done
# done

COMPREPLY=( $(echo ${COMPREPLY} | uniq | sort) )
# COMPREPLY=( $(echo ${COMPREPLY} | uniq | sort) )

else
# else

COMPREPLY=( $(compgen -d ${current}) )
# COMPREPLY=( $(compgen -d ${current}) )

fi
# fi

}
# }

complete -o filenames -o dirnames -o nospace -F _rvm_cd_complete cd
# complete -o filenames -o dirnames -o nospace -F _rvm_cd_complete cd

fi

Expand Down

0 comments on commit 5b509a9

Please sign in to comment.