mirror of
https://github.com/jorgebucaran/fisher
synced 2024-06-24 22:51:49 +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}
|
||||
|
||||
fish -c "
|
||||
if test -e $plugin
|
||||
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
|
||||
fish --command "
|
||||
if test -e $plugin
|
||||
command cp -Rf $plugin/* $source
|
||||
else
|
||||
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
||||
command rm -rf $source
|
||||
end
|
||||
command rm -rf \$temp
|
||||
end
|
||||
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]
|
||||
|
||||
test ! -e $source && exit
|
||||
command mv -f (string match --entire --regex -- \.fish\\\$ $source/*) $source/functions 2>/dev/null" &
|
||||
string unescape \"Fetching \x1b[4m\$url\x1b[24m\"
|
||||
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)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue