dotfiles
1function _nvm_index_update --argument-names mirror index
2 if not command curl --location --silent $mirror/index.tab >$index.temp
3 command rm -f $index.temp
4 echo "nvm: Can't update index, host unavailable: \"$mirror\"" >&2
5 return 1
6 end
7
8 command awk -v OFS=\t '
9 /v0.9.12/ { exit } # Unsupported
10 NR > 1 {
11 print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "")
12 }
13 ' $index.temp >$index
14
15 command rm -f $index.temp
16end