plugins: added nvm and sdkman (#150)

* feat(plugins): added sdkman plugin

* feat(plugins): added nvm plugin

* fix: fixed the codacy issues
This commit is contained in:
Rishikesh Darandale 2020-05-11 12:59:06 +05:30 committed by GitHub
parent 48df2df79c
commit 3ebd9b84f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 0 deletions

40
plugins/nvm/README.md Normal file

@ -0,0 +1,40 @@
# nvm plugin
This plugin automatically source nvm[1]
## Installation
### Install nvm
Lets install[2] the nvm without updaing shell config!
```bash
export NVM_DIR="$HOME/.nvm" && (
git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR"
cd "$NVM_DIR"
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$NVM_DIR/nvm.sh"
```
### Include nvm as plugin
```bash
plugins=(
git
nvm
)
```
## nvm completion configuration
```bash
completions=(
git
composer
ssh
nvm
)
```
[1]: https://github.com/nvm-sh/nvm
[2]: https://github.com/nvm-sh/nvm#manual-install

12
plugins/nvm/nvm.plugin.sh Normal file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Set NVM_DIR if it isn't already defined
[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm"
# Try to load nvm only if command not already available
if ! type "nvm" &> /dev/null; then
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# This is done as part of completions!!!
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi

25
plugins/sdkman/README.md Normal file

@ -0,0 +1,25 @@
# sdkman plugin
This plugin automatically source sdkman[1]
## Installation
### Install sdkman
Lets install[2] the sdkman without updaing shell config!
```bash
$ curl -s "https://get.sdkman.io?rcupdate=false" | bash
```
### Include sdkman as plugin
```bash
plugins=(
git
sdkman
)
```
[1]: https://sdkman.io/
[2]: https://sdkman.io/install

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Set NVM_DIR if it isn't already defined
[[ -z "$SDKMAN_DIR" ]] && export NVM_DIR="$HOME/.sdkman"
# Try to load sdk only if command not already available
if ! type "sdk" &> /dev/null; then
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
fi