-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add plugin-pyenv as an available function for fish #3
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
<img src="https://cdn.rawgit.com/oh-my-fish/oh-my-fish/e4f1c2e0219a17e2c748b824004c8d0b38055c16/docs/logo.svg" align="left" width="144px" height="144px"/> | ||
|
||
# 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! | ||
|
||
<br /> | ||
<br /> | ||
|
||
## 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! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
function pyenv-init --description "Pyenv initialization script for fish shell" | ||
|
||
# Checks if directories already exists. If not, creates then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't pyenv take care of this? And is it really necessary to check every time a new session is created? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could also be solved by the init function. It is not necessary to run that on every new session. |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this might be something related to making There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really do not know this behavior in other OSs. I just keep the way this plugin did. |
||
end |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The beauty of plugins is them being able to just work out of the box, with the least possible being left up to the user. That means the
init
function of a plugin does all the witchery.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree. I did not find how to create this init. Since it is possible, this function may do that easier for users.