mirror of
https://github.com/jorgebucaran/fisher
synced 2024-10-13 09:46:52 +02:00
27 lines
597 B
Fish
27 lines
597 B
Fish
|
function __fisher_index_update
|
||
|
set -l timeout 5
|
||
|
|
||
|
if set -q fisher_timeout
|
||
|
set timeout "0$fisher_timeout"
|
||
|
end
|
||
|
|
||
|
set -l index $fisher_cache/.index.tmp
|
||
|
|
||
|
# We pass a random query string after the URL to force the the
|
||
|
# server (GitHub) to always return the latest copy of the index.
|
||
|
|
||
|
set -l query $fisher_index
|
||
|
|
||
|
switch "$fisher_index"
|
||
|
case https://\*
|
||
|
set query $fisher_index\?(date +%s)
|
||
|
end
|
||
|
|
||
|
if not curl --max-time $timeout -sS "$query" > $index
|
||
|
rm -f $index
|
||
|
return 1
|
||
|
end
|
||
|
|
||
|
mv -f $index $fisher_cache/.index
|
||
|
end
|