update fisher
This commit is contained in:
@@ -1,17 +1,18 @@
|
|||||||
function fisher --argument-names cmd --description "A plugin manager for Fish"
|
function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
||||||
set --local fisher_version 4.4.5
|
set --local fisher_version 4.4.8
|
||||||
set --local fish_plugins $__fish_config_dir/fish_plugins
|
set --local fish_plugins $__fish_config_dir/fish_plugins
|
||||||
|
|
||||||
switch "$cmd"
|
switch "$cmd"
|
||||||
case -v --version
|
case -v --version
|
||||||
echo "fisher, version $fisher_version"
|
echo "fisher, version $fisher_version"
|
||||||
case "" -h --help
|
case "" -h --help
|
||||||
echo "Usage: fisher install <plugins...> Install plugins"
|
echo "Usage: fisher install <plugins...> Install plugins"
|
||||||
echo " fisher remove <plugins...> Remove installed plugins"
|
echo " fisher remove <plugins...> Remove installed plugins"
|
||||||
echo " fisher update <plugins...> Update installed plugins"
|
echo " fisher uninstall <plugins...> Remove installed plugins (alias)"
|
||||||
echo " fisher update Update all installed plugins"
|
echo " fisher update <plugins...> Update installed plugins"
|
||||||
echo " fisher list [<regex>] List installed plugins matching regex"
|
echo " fisher update Update all installed plugins"
|
||||||
|
echo " fisher list [<regex>] List installed plugins matching regex"
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -v, --version Print version"
|
echo " -v, --version Print version"
|
||||||
echo " -h, --help Print this help message"
|
echo " -h, --help Print this help message"
|
||||||
@@ -19,9 +20,11 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
|||||||
echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
|
echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
|
||||||
case ls list
|
case ls list
|
||||||
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
||||||
case install update remove
|
case install update remove uninstall
|
||||||
isatty || read --local --null --array stdin && set --append argv $stdin
|
isatty || read --local --null --array stdin && set --append argv $stdin
|
||||||
|
|
||||||
|
test "$cmd" = uninstall && set cmd remove
|
||||||
|
|
||||||
set --local install_plugins
|
set --local install_plugins
|
||||||
set --local update_plugins
|
set --local update_plugins
|
||||||
set --local remove_plugins
|
set --local remove_plugins
|
||||||
@@ -38,6 +41,8 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
|||||||
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
|
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
|
||||||
end
|
end
|
||||||
set arg_plugins $file_plugins
|
set arg_plugins $file_plugins
|
||||||
|
else if test "$cmd" = install && ! set --query old_plugins[1]
|
||||||
|
set --append arg_plugins $file_plugins
|
||||||
end
|
end
|
||||||
|
|
||||||
for plugin in $arg_plugins
|
for plugin in $arg_plugins
|
||||||
@@ -86,6 +91,7 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
|||||||
if test -e $plugin
|
if test -e $plugin
|
||||||
command cp -Rf $plugin/* $source
|
command cp -Rf $plugin/* $source
|
||||||
else
|
else
|
||||||
|
set resp (command mktemp)
|
||||||
set temp (command mktemp -d)
|
set temp (command mktemp -d)
|
||||||
set repo (string split -- \@ $plugin) || set repo[2] HEAD
|
set repo (string split -- \@ $plugin) || set repo[2] HEAD
|
||||||
|
|
||||||
@@ -98,8 +104,13 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
|||||||
|
|
||||||
echo Fetching (set_color --underline)\$url(set_color normal)
|
echo Fetching (set_color --underline)\$url(set_color normal)
|
||||||
|
|
||||||
if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null
|
set http (command curl -q --silent -L -o \$resp -w %{http_code} \$url)
|
||||||
|
|
||||||
|
if test \"\$http\" = 200 && command tar -xzC \$temp -f \$resp 2>/dev/null
|
||||||
command cp -Rf \$temp/*/* $source
|
command cp -Rf \$temp/*/* $source
|
||||||
|
else if test \"\$http\" = 403
|
||||||
|
echo fisher: GitHub API rate limit exceeded \(HTTP 403\) >&2
|
||||||
|
command rm -rf $source
|
||||||
else
|
else
|
||||||
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
||||||
command rm -rf $source
|
command rm -rf $source
|
||||||
|
|||||||
Reference in New Issue
Block a user