diff options
author | Guangxiong Lin <[email protected]> | 2023-11-15 08:58:19 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2023-11-15 08:58:19 +0800 |
commit | 016c96d8af4c944fb2b9fc0c673f5130472a7977 (patch) | |
tree | b8410f3cea2780043d66a67a8b1e173930488bed /.config/fish/functions/_nvm_index_update.fish | |
parent | 55c2d8e73db4e9e93cddcb981c15fb8fe9b1dcf4 (diff) | |
download | dotfiles-016c96d8af4c944fb2b9fc0c673f5130472a7977.tar.gz dotfiles-016c96d8af4c944fb2b9fc0c673f5130472a7977.tar.bz2 dotfiles-016c96d8af4c944fb2b9fc0c673f5130472a7977.zip |
Update aliases and add fisher
Diffstat (limited to '.config/fish/functions/_nvm_index_update.fish')
-rw-r--r-- | .config/fish/functions/_nvm_index_update.fish | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/.config/fish/functions/_nvm_index_update.fish b/.config/fish/functions/_nvm_index_update.fish new file mode 100644 index 0000000..c1bbe28 --- /dev/null +++ b/.config/fish/functions/_nvm_index_update.fish @@ -0,0 +1,20 @@ +function _nvm_index_update + test ! -d $nvm_data && command mkdir -p $nvm_data + + set --local index $nvm_data/.index + + if not command curl --location --silent $nvm_mirror/index.tab >$index.temp + command rm -f $index.temp + echo "nvm: Can't update index, host unavailable: \"$nvm_mirror\"" >&2 + return 1 + end + + command awk -v OFS=\t ' + /v0.9.12/ { exit } # Unsupported + NR > 1 { + print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "") + } + ' $index.temp >$index + + command rm -f $index.temp +end |