README: make fish PATH add conditional on the directory existing (#2786)

This commit is contained in:
Tom Godkin 2025-05-17 14:13:12 +01:00 committed by GitHub
parent 2d8bd15ccd
commit 90fa430eca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -83,7 +83,7 @@ This project was forked from [rbenv](https://github.com/rbenv/rbenv) and
<details> <details>
The Homebrew option from the [MacOS section below](#macos) would also work if you have Homebrew installed. The Homebrew option from the [MacOS section below](#macos) would also work if you have Homebrew installed.
##### 1. Automatic installer (Recommended) ##### 1. Automatic installer (Recommended)
```bash ```bash
@ -114,7 +114,7 @@ easy to fork and contribute any changes back upstream.
#### MacOS #### MacOS
<details> <details>
The options from the [Linux section above](#linuxunix) also work but Homebrew is recommended for basic usage. The options from the [Linux section above](#linuxunix) also work but Homebrew is recommended for basic usage.
##### [Homebrew](https://brew.sh) in macOS ##### [Homebrew](https://brew.sh) in macOS
@ -229,27 +229,27 @@ See [Advanced configuration](#advanced-configuration) for details and more confi
If you wish to get Pyenv in noninteractive login shells as well, also add the commands to `~/.zprofile` or `~/.zlogin`. If you wish to get Pyenv in noninteractive login shells as well, also add the commands to `~/.zprofile` or `~/.zlogin`.
</details> </details>
#### Fish #### Fish
<details> <details>
1. If you have Fish 3.2.0 or newer, execute this interactively: 1. If you have Fish 3.2.0 or newer, execute this interactively:
~~~ fish ```fish
set -Ux PYENV_ROOT $HOME/.pyenv set -Ux PYENV_ROOT $HOME/.pyenv
fish_add_path $PYENV_ROOT/bin test -d $PYENV_ROOT/bin; and fish_add_path $PYENV_ROOT/bin
~~~ ```
2. Otherwise, execute the snippet below: 2. Otherwise, execute the snippet below:
~~~ fish ```fish
set -Ux PYENV_ROOT $HOME/.pyenv set -Ux PYENV_ROOT $HOME/.pyenv
set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths test -d $PYENV_ROOT/bin; and set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths
~~~ ```
3. Now, add this to `~/.config/fish/config.fish`: 3. Now, add this to `~/.config/fish/config.fish`:
~~~ fish ```fish
pyenv init - fish | source pyenv init - fish | source
~~~ ```
</details> </details>
### C. Restart your shell ### C. Restart your shell