fisher/functions/__fisher_index_update.fish
2016-02-07 20:08:08 +09:00

27 lines
629 B
Fish

function __fisher_index_update -a timeout
if test -z "$timeout"
set timeout 5
if set -q fisher_timeout
set timeout "0$fisher_timeout"
end
end
set -l url $fisher_index
set -l index $fisher_cache/.index.tmp
if test -z "$url"
# Force the server to return the latest copy of the index using a fake query string.
set url https://raw.githubusercontent.com/fisherman/fisher-index/master/index\?(date +%s)
end
if not curl --max-time $timeout -sS "$url" > $index
rm -f $index
return 1
end
mv -f $index $fisher_cache/.index
end