fisher/functions/__fisher_index_update.fish
Daniele Sluijters a11bbee41d Use command when calling non-builtins
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
2016-02-07 18:48:42 +01:00

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