[feature] add asdf setup script

This commit is contained in:
Klesh Wong 2021-06-27 15:32:49 +08:00
parent b9ea068827
commit 041e4b5fc5
3 changed files with 17 additions and 2 deletions

14
cli/asdf.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
# install asdf, a multi-lang version manager
if ! has_cmd "asdf"; then
git_clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.1
mkdir -p ~/.config/fish/completions; and ln -s ~/.asdf/completions/asdf.fish ~/.config/fish/completions
asdf plugin add nodejs
asdf install nodejs latest
asdf global nodejs latest
fi

View File

@ -60,6 +60,7 @@ if status is-interactive
append_paths ~/go/bin ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin append_paths ~/go/bin ~/bin ~/.local/bin ~/.yarn/bin ~/dotfiles/bin ~/dotfiles/devops/bin
source_files /usr/share/autojump/autojump.fish /usr/local/share/autojump/autojump.fish \ source_files /usr/share/autojump/autojump.fish /usr/local/share/autojump/autojump.fish \
~/.jabba/jabba.fish \ ~/.jabba/jabba.fish \
~/.asdf/asdf.fish \
~/.profile.fish ~/.profile.fish
# === auto cd into last activated directory # === auto cd into last activated directory

4
env.sh
View File

@ -44,9 +44,9 @@ git_clone() {
mkdir -p "$(dirname "$2")" mkdir -p "$(dirname "$2")"
[ -d "$2" ] && return [ -d "$2" ] && return
if echo "$1" | grep -qF 'github.com'; then if echo "$1" | grep -qF 'github.com'; then
HTTPS_PROXY=$GITHUB_PROXY git clone --depth 1 "$1" "$2" HTTPS_PROXY=$GITHUB_PROXY git clone --depth 1 "$@"
else else
git clone --depth 1 "$1" "$2" git clone --depth 1 "$@"
fi fi
} }