diff --git a/README.md b/README.md new file mode 100644 index 0000000..4c00462 --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ + + + +# Pyenv Plugin for Fish Shell +Use [Pyenv](https://github.com/pyenv/pyenv) with [fish shell](https://fishshell.com) managed by [Oh my fish](https://github.com/oh-my-fish/oh-my-fish) in a very simple way! + +
+
+ +## Installation + +```fish +omf update # Just if your omf installation is old. Avoids missing the package +omf install pyenv +``` +> omf (Oh my fish) is a package manager for fish shell. Just like pip is for Python and gem is for Ruby + +## Usage + +Just add the following line in your ```config.fish``` file: + +```fish +# Initializes Pyenv +pyenv-init +``` + +This will initialize pyenv every time a new Fish session starts. +And that is all! diff --git a/functions/pyenv-init.fish b/functions/pyenv-init.fish new file mode 100644 index 0000000..a69cf56 --- /dev/null +++ b/functions/pyenv-init.fish @@ -0,0 +1,16 @@ + +function pyenv-init --description "Pyenv initialization script for fish shell" + + # Checks if directories already exists. If not, creates then + for dir in "shims" "bin" + if not test -d $HOME/pyenv/$dir + mkdir -p $HOME/pyenv/$dir + end + end + + # Respects if PYENV_ROOT exists. Otherwise, sets it to a default directory + set --query PYENV_ROOT; or set --local PYENV_ROOT $HOME/.pyenv + + # Appends PYENV_ROOT directories to PATH variable + set PATH $PYENV_ROOT/shims $PYENV_ROOT/bin $PATH +end diff --git a/init.fish b/init.fish deleted file mode 100644 index e2a011e..0000000 --- a/init.fish +++ /dev/null @@ -1,3 +0,0 @@ -set -q PYENV_ROOT; or set -l PYENV_ROOT $HOME/.pyenv - -set PATH $PYENV_ROOT/shims $PYENV_ROOT/bin $PATH