Handle case where nodenv-commands --sh
returns nothing
#217
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In exceptional cases (e.g., custom installation, malfunctions elsewhere),
nodenv-commands --sh
may return nothing. In non-Fish shells, this would cause "syntax error near unexpected token)'" in
nodenv()`.Bash does not allow one to specify a
case
option without a pattern. We work around it by defaulting to/
. Commands, being filenames, can never match it. In Fish, nothing needs to be done: it apparently does interpret acase
without an argument as one that never matches.This patch is based on 02e1d4a1 from
pyenv
, which was written by @ native-api and I.Feel free to edit the commit message as needed, but I would appreciate if you kept most of it. I sometimes find it useful to grep the Git logs when developing.
If you want to see some discussion about the original patch for
pyenv
, look at pyenv/pyenv#2908.Footnotes
https://github.com/pyenv/pyenv/commit/02e1d4a293139ecf2c94206ee9c00b388550366e ↩