[Docs] [Tests] Add escape sequences; add test for aliased `.`
parent
d34bb3247d
commit
7ca8acc98d
10
README.md
10
README.md
|
@ -54,7 +54,7 @@ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh |
|
|||
|
||||
```sh
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
```
|
||||
|
||||
You can customize the install source, directory, profile, and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE`, and `NODE_VERSION` variables.
|
||||
|
@ -148,7 +148,7 @@ export NVM_DIR="$HOME/.nvm" && (
|
|||
git clone https://github.com/creationix/nvm.git "$NVM_DIR"
|
||||
cd "$NVM_DIR"
|
||||
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
|
||||
) && . "$NVM_DIR/nvm.sh"
|
||||
) && \. "$NVM_DIR/nvm.sh"
|
||||
```
|
||||
|
||||
Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login:
|
||||
|
@ -156,7 +156,7 @@ Now add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to hav
|
|||
|
||||
```sh
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
```
|
||||
|
||||
### Manual upgrade
|
||||
|
@ -173,7 +173,7 @@ For manual upgrade with `git` (requires git v1.7.10+):
|
|||
cd "$NVM_DIR"
|
||||
git fetch origin
|
||||
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
|
||||
) && . "$NVM_DIR/nvm.sh"
|
||||
) && \. "$NVM_DIR/nvm.sh"
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
@ -426,7 +426,7 @@ Nota bene: Avoid running nvm while the tests are running.
|
|||
To activate, you need to source `bash_completion`:
|
||||
|
||||
```sh
|
||||
[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion
|
||||
[[ -r $NVM_DIR/bash_completion ]] && \. $NVM_DIR/bash_completion
|
||||
```
|
||||
|
||||
Put the above sourcing line just below the sourcing line for nvm in your profile (`.bashrc`, `.bash_profile`).
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
setup () {
|
||||
shopt -s expand_aliases
|
||||
alias .=':'
|
||||
NVM_ENV=testing \. ../../install.sh > /dev/null
|
||||
}
|
||||
|
||||
cleanup () {
|
||||
unset -f setup cleanup die
|
||||
unalias .
|
||||
shopt -u expand_aliases
|
||||
}
|
||||
|
||||
die () { echo "$@"; exit 1; }
|
||||
|
||||
setup
|
||||
|
||||
nvm_do_install > /dev/null 2>&1
|
||||
command -v nvm || die 'nvm could not be loaded'
|
||||
|
||||
cleanup
|
||||
|
Loading…
Reference in New Issue