Sha256: 17f843ccd5dfdb7077897a2752541e72dd1f5972b8cb825cbfaefc8b816e0576

Contents?: true

Size: 1.46 KB

Versions: 11

Compression:

Stored size: 1.46 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 directory current matches item index

      COMPREPLY=()

      current="${COMP_WORDS[COMP_CWORD]}"

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

        index=${#COMPREPLY[@]}

        for directory in $(echo "$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 nospace -F _rvm_cd_complete cd

    }

  fi

fi

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
rvm-1.0.15 scripts/cd
gemrage-1.0.0 vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd
gemrage-0.4.1 vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd
gemrage-0.4.0 vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd
gemrage-0.3.2 vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd
gemrage-0.3.1 vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd
gemrage-0.3.0 vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd
gemrage-0.2.0 vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd
gemrage-0.1.2 vendor/ruby/1.8/gems/rvm-1.0.14/scripts/cd
rvm-1.0.14 scripts/cd
rvm-1.0.13 scripts/cd