1
0
Fork 0
mirror of https://github.com/SeriousBug/dotfiles synced 2024-09-19 17:06:17 -05:00
dotfiles/fish/functions/_nvm_index_update.fish

17 lines
508 B
Fish
Raw Normal View History

2022-03-06 21:42:47 -06:00
function _nvm_index_update --argument-names mirror index
2022-05-08 02:01:46 -05:00
if not command curl --location --silent $mirror/index.tab >$index.temp
command rm -f $index.temp
echo "nvm: Can't update index, host unavailable: \"$mirror\"" >&2
return 1
end
command awk -v OFS=\t '
2022-03-06 21:42:47 -06:00
/v0.9.12/ { exit } # Unsupported
NR > 1 {
print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "")
}
2022-05-08 02:01:46 -05:00
' $index.temp >$index
2022-03-06 21:42:47 -06:00
command rm -f $index.temp
end