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