Sha256: 9a469c397d307e3dfd942bdd8efac07c55a1f24793c35b4bf56cfd59982b4ec7

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

#!/usr/bin/env bash

# Source a .rvmrc file in a directory after changing to it, if it exists.
# To disable this fature, set export rvm_project_rvmrc=0 in $HOME/.rvmrc
if [[ ${rvm_project_rvmrc:-1} -ne 0 ]] ; then

  if [[ -n "${ZSH_VERSION:-""}" ]] ; then

    autoload is-at-least

    if is-at-least 4.3.4 >/dev/null 2>&1; then

      # On zsh, use chpwd_functions
      chpwd_functions=( "${chpwd_functions[@]}" __rvm_project_rvmrc )

    else

      cd()
      {
        builtin cd "$@"

        local result=$?

        __rvm_project_rvmrc

        rvm_hook="after_cd" ; source "$rvm_path/scripts/hook"

        return $result
      }

    fi

  else

    cd()
    {
      builtin cd "$@"

      local result=$?

      __rvm_project_rvmrc

      rvm_hook="after_cd" ; source "$rvm_path/scripts/hook"

      return $result
    }

    #
    # 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=()

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

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

    #     index=${#COMPREPLY[@]}

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

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

    #         item="${item}/"

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

    #       done

    #     done

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

    #   else

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

    #   fi

    # }

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

  fi

fi

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rvm-1.0.19 scripts/cd
rvm-1.0.18 scripts/cd
rvm-1.0.17 scripts/cd