Sha256: 498b961ee757d743dde317cabd694c1272ff24bb450bcd39bbcf4eefb8f4d3bf

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 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
    }

    _rvm_cd_complete ()
    {
      local cur matches
      COMPREPLY=()
      cur="${COMP_WORDS[COMP_CWORD]}"

      matches=$(for dir in $(echo $CDPATH | tr -s ':' ' ') ; do
        find $dir/* -type d -maxdepth 0 -exec basename {} \;
      done | sort | uniq)

      COMPREPLY=( $(compgen -W "${matches}" -- ${cur}) )
    }

    complete -o bashdefault -o default -o dirnames -o filenames -o nospace -o plusdirs -F _rvm_cd_complete cd

  fi

fi

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rvm-1.0.11 scripts/cd