diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2022-07-07 12:43:35 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2022-07-07 12:43:35 -0300 |
commit | 4b1fd798bf3b863dc640c458442e50cf2f8a14e2 (patch) | |
tree | d67af90f2244867620acc7dfd9e1c4b04155b230 | |
parent | c38bd8f3b00fb1d9af970fd1bf20d2cc006aad8e (diff) | |
download | profile-4b1fd798bf3b863dc640c458442e50cf2f8a14e2.tar.gz profile-4b1fd798bf3b863dc640c458442e50cf2f8a14e2.tar.bz2 |
Feat: pyenv support for bash and zsh
-rw-r--r-- | profile.dot.link | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/profile.dot.link b/profile.dot.link index cd4b022..e6de5a7 100644 --- a/profile.dot.link +++ b/profile.dot.link @@ -130,6 +130,43 @@ fi export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +# PyEnv +if [ -d "$HOME/.pyenv" ]; then + export PYENV_ROOT="$HOME/.pyenv" + command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" + + PATH="$(bash --norc -ec 'IFS=:; paths=($PATH); for i in ${!paths[@]}; do if [[ ${paths[i]} == "'$HOME/.pyenv/shims'" ]]; then unset '\''paths[i]'\''; fi; done; echo "${paths[*]}"')" + PATH="$HOME/.pyenv/shims:${PATH}" + + if [ "$0" = "bash" ]; then + export PYENV_SHELL=bash + source '$HOME/.pyenv/libexec/../completions/pyenv.bash' + elif [ "$0" = "bash" ]; then + export PYENV_SHELL=zsh + source '$HOME/.pyenv/libexec/../completions/pyenv.zsh' + fi + + command pyenv rehash 2>/dev/null + + pyenv() { + local command + command="${1:-}" + + if [ "$#" -gt 0 ]; then + shift + fi + + case "$command" in + rehash|shell) + eval "$(pyenv "sh-$command" "$@")" + ;; + *) + command pyenv "$command" "$@" + ;; + esac + } +fi + # Export PATH export PATH=$PATH @@ -410,7 +447,7 @@ cd $STARTUP_FOLDER # scripts="`find $HOME/.profile.d -type f`" # # for script in $scripts; do -# include $script +# source $script # done #fi @@ -419,7 +456,7 @@ cd $STARTUP_FOLDER # scripts="`find $HOME/.custom/profile.d -type f`" # # for script in $scripts; do -# include $script +# source $script # done #fi |