mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-17 11:03:44 +00:00
Compare commits
3 Commits
a3f8b5403b
...
cf4afb212f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cf4afb212f | ||
![]() |
4beab63631 | ||
![]() |
510d152ee5 |
@ -646,7 +646,7 @@ cdnvm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
alias cd='cdnvm'
|
alias cd='cdnvm'
|
||||||
cdnvm "$PWD" || exit
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This alias would search 'up' from your current directory in order to detect a `.nvmrc` file. If it finds it, it will switch to that version; if not, it will use the default version.
|
This alias would search 'up' from your current directory in order to detect a `.nvmrc` file. If it finds it, it will switch to that version; if not, it will use the default version.
|
||||||
|
12
nvm.sh
12
nvm.sh
@ -503,9 +503,9 @@ $(nvm_wrap_with_color_code 'y' "${warn_text}")"
|
|||||||
}
|
}
|
||||||
|
|
||||||
nvm_process_nvmrc() {
|
nvm_process_nvmrc() {
|
||||||
local NVMRC_PATH="$1"
|
local NVMRC_PATH
|
||||||
|
NVMRC_PATH="$1"
|
||||||
local lines
|
local lines
|
||||||
local unpaired_line
|
|
||||||
|
|
||||||
lines=$(command sed 's/#.*//' "$NVMRC_PATH" | command sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | nvm_grep -v '^$')
|
lines=$(command sed 's/#.*//' "$NVMRC_PATH" | command sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | nvm_grep -v '^$')
|
||||||
|
|
||||||
@ -515,8 +515,12 @@ nvm_process_nvmrc() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialize key-value storage
|
# Initialize key-value storage
|
||||||
local keys=''
|
local keys
|
||||||
local values=''
|
keys=''
|
||||||
|
local values
|
||||||
|
values=''
|
||||||
|
local unpaired_line
|
||||||
|
unpaired_line=''
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [ -z "${line}" ]; then
|
if [ -z "${line}" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user