mirror of
https://github.com/jorgebucaran/fisher
synced 2024-11-01 21:40:18 +00:00
a11bbee41d
By using `command` we ensure that we always end up calling the external binary and don't get caught by user aliasses, functions or other magic. Closes #79
27 lines
645 B
Fish
27 lines
645 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
|
|
command rm -f $index
|
|
return 1
|
|
end
|
|
|
|
command mv -f $index $fisher_cache/.index
|
|
end
|