aboutsummaryrefslogtreecommitdiff
path: root/fish/functions/_nvm_index_update.fish
diff options
context:
space:
mode:
authorIndrajith K L2024-06-27 17:51:18 +0530
committerIndrajith K L2024-06-27 17:51:18 +0530
commit57eb70137b5bbcdabdc0f02eea5477b3e5f845a1 (patch)
treee78187146c506d5a640545dee99cc3e9860e25dc /fish/functions/_nvm_index_update.fish
downloaddots-57eb70137b5bbcdabdc0f02eea5477b3e5f845a1.tar.gz
dots-57eb70137b5bbcdabdc0f02eea5477b3e5f845a1.tar.bz2
dots-57eb70137b5bbcdabdc0f02eea5477b3e5f845a1.zip
Adds Arch Linux dotfiles
Diffstat (limited to 'fish/functions/_nvm_index_update.fish')
-rw-r--r--fish/functions/_nvm_index_update.fish20
1 files changed, 20 insertions, 0 deletions
diff --git a/fish/functions/_nvm_index_update.fish b/fish/functions/_nvm_index_update.fish
new file mode 100644
index 000000000..c66753d0e
--- /dev/null
+++ b/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 -q --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