fisher/functions/__fisher_index_update.fish
Jorge Bucaran ebf1de50a1 Ahoy! Fisherman 1.4.0 has shipped.
Notable changes:

+ Now fisher list does not show plugins that are disabled,
  but available in the cache. To preview these items use
  fisher list --disabled.

+ Welcome aboard @orangecms and @xrain0610.

+ Fisherman is now available in AUR, thanks @orangecms.

+ Fix load order during installation. Now snippets can
  safely invoke functions defined in the plugin function
  directory. Thanks @orangecms. #170.

+ Fisherman **installs and updates plugins ⌁concurrently**.
  Performance may vary, but if you can see 5 to 10 times
  faster network times, it's working well.
2016-03-31 02:42:44 +09:00

30 lines
714 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
if test ! -d $fisher_cache
mkdir -p $fisher_cache
end
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