mirror of
https://github.com/jorgebucaran/fisher
synced 2024-06-28 23:01:50 +02:00
Refactor parallel fetch subcommand
- Remove undocumented fisher_user_api_token. - Can always re-add if there's a need. - Use string unescape which is faster.
This commit is contained in:
parent
a2e3d5463f
commit
48a61924ad
39
fisher.fish
39
fisher.fish
|
@ -75,27 +75,28 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
|
|
||||||
command mkdir -p $source/{completions,conf.d,functions}
|
command mkdir -p $source/{completions,conf.d,functions}
|
||||||
|
|
||||||
fish -c "
|
fish --command "
|
||||||
if test -e $plugin
|
if test -e $plugin
|
||||||
command cp -Rf $plugin/* $source
|
command cp -Rf $plugin/* $source
|
||||||
else
|
|
||||||
set temp (command mktemp -d)
|
|
||||||
set name (string split \@ $plugin) || set name[2] HEAD
|
|
||||||
set url https://codeload.github.com/\$name[1]/tar.gz/\$name[2]
|
|
||||||
set --query fisher_user_api_token && set opts -u $fisher_user_api_token
|
|
||||||
|
|
||||||
echo -e \"Fetching \x1b[4m\$url\x1b[24m\"
|
|
||||||
if curl $opts --silent \$url | tar --extract --gzip --directory \$temp --file -
|
|
||||||
command cp -Rf \$temp/*/* $source
|
|
||||||
else
|
else
|
||||||
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
set temp (command mktemp -d)
|
||||||
command rm -rf $source
|
set name (string split \@ $plugin) || set name[2] HEAD
|
||||||
end
|
set url https://codeload.github.com/\$name[1]/tar.gz/\$name[2]
|
||||||
command rm -rf \$temp
|
|
||||||
end
|
|
||||||
|
|
||||||
test ! -e $source && exit
|
string unescape \"Fetching \x1b[4m\$url\x1b[24m\"
|
||||||
command mv -f (string match --entire --regex -- \.fish\\\$ $source/*) $source/functions 2>/dev/null" &
|
if curl --silent \$url | tar --extract --gzip --directory \$temp --file - 2>/dev/null
|
||||||
|
command cp -Rf \$temp/*/* $source
|
||||||
|
else
|
||||||
|
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
||||||
|
command rm -rf $source
|
||||||
|
end
|
||||||
|
command rm -rf \$temp
|
||||||
|
end
|
||||||
|
|
||||||
|
test -e $source && command mv -f (
|
||||||
|
string match --entire --regex -- \.fish\\\$ $source/*
|
||||||
|
) $source/functions 2>/dev/null
|
||||||
|
" &
|
||||||
|
|
||||||
set --append pid_list (jobs --last --pid)
|
set --append pid_list (jobs --last --pid)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue