mirror of
https://github.com/jorgebucaran/fisher
synced 2024-10-09 09:36:53 +02:00
Guard stdout/err redirections by quotes.
This commit is contained in:
parent
5e356e8ee4
commit
b90c36d7fb
1 changed files with 41 additions and 41 deletions
82
fisher.fish
82
fisher.fish
|
@ -195,11 +195,11 @@ function $fisher_cmd_name
|
||||||
if test -z "$items"
|
if test -z "$items"
|
||||||
__fisher_log info "
|
__fisher_log info "
|
||||||
No plugins to install or dependencies missing.
|
No plugins to install or dependencies missing.
|
||||||
" $__fisher_stderr
|
" > /dev/stderr
|
||||||
|
|
||||||
__fisher_log info "
|
__fisher_log info "
|
||||||
See @$fisher_cmd_name help@ for usage instructions.
|
See @$fisher_cmd_name help@ for usage instructions.
|
||||||
" $__fisher_stderr
|
" > /dev/stderr
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -217,7 +217,7 @@ function $fisher_cmd_name
|
||||||
__fisher_log info "
|
__fisher_log info "
|
||||||
Please install git and try again.
|
Please install git and try again.
|
||||||
Visit <@https://git-scm.com@> for more information.
|
Visit <@https://git-scm.com@> for more information.
|
||||||
" $__fisher_stderr
|
" > /dev/stderr
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
@ -231,7 +231,7 @@ function $fisher_cmd_name
|
||||||
__fisher_log info "
|
__fisher_log info "
|
||||||
Please install curl and try again.
|
Please install curl and try again.
|
||||||
Refer to your package manager documentation for instructions.
|
Refer to your package manager documentation for instructions.
|
||||||
" $__fisher_stderr
|
" > /dev/stderr
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
@ -240,7 +240,7 @@ function $fisher_cmd_name
|
||||||
switch "$cmd"
|
switch "$cmd"
|
||||||
case install
|
case install
|
||||||
if __fisher_install $items
|
if __fisher_install $items
|
||||||
__fisher_log info "Done in @"(__fisher_get_epoch_in_ms $elapsed | __fisher_humanize_duration)"@" $__fisher_stderr
|
__fisher_log info "Done in @"(__fisher_get_epoch_in_ms $elapsed | __fisher_humanize_duration)"@" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
|
|
||||||
case update
|
case update
|
||||||
|
@ -257,7 +257,7 @@ function $fisher_cmd_name
|
||||||
|
|
||||||
__fisher_update $items
|
__fisher_update $items
|
||||||
|
|
||||||
__fisher_log info "Done in @"(__fisher_get_epoch_in_ms $elapsed | __fisher_humanize_duration)"@" $__fisher_stderr
|
__fisher_log info "Done in @"(__fisher_get_epoch_in_ms $elapsed | __fisher_humanize_duration)"@" "$__fisher_stderr"
|
||||||
|
|
||||||
case ls
|
case ls
|
||||||
if test "$argv" -ge 0 -o "$argv" = -
|
if test "$argv" -ge 0 -o "$argv" = -
|
||||||
|
@ -314,13 +314,13 @@ function $fisher_cmd_name
|
||||||
|
|
||||||
__fisher_log error "
|
__fisher_log error "
|
||||||
I can't remove @$name@ without its real path.
|
I can't remove @$name@ without its real path.
|
||||||
" $__fisher_stderr
|
" "$__fisher_stderr"
|
||||||
|
|
||||||
__fisher_log info "
|
__fisher_log info "
|
||||||
Restore @$real_path@ and try again.
|
Restore @$real_path@ and try again.
|
||||||
" $__fisher_stderr
|
" "$__fisher_stderr"
|
||||||
else
|
else
|
||||||
__fisher_log info "You can only remove plugins you've installed." $__fisher_stderr
|
__fisher_log info "You can only remove plugins you've installed." "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
|
|
||||||
break
|
break
|
||||||
|
@ -330,7 +330,7 @@ function $fisher_cmd_name
|
||||||
if test ! -z "$items"
|
if test ! -z "$items"
|
||||||
__fisher_remove $items
|
__fisher_remove $items
|
||||||
__fisher_log info "Done in @"(
|
__fisher_log info "Done in @"(
|
||||||
__fisher_get_epoch_in_ms $elapsed | __fisher_humanize_duration)"@" $__fisher_stderr
|
__fisher_get_epoch_in_ms $elapsed | __fisher_humanize_duration)"@" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ function __fisher_install
|
||||||
if test -z "$fetched"
|
if test -z "$fetched"
|
||||||
__fisher_log info "
|
__fisher_log info "
|
||||||
No plugins to install or dependencies missing.
|
No plugins to install or dependencies missing.
|
||||||
" $__fisher_stderr
|
" "$__fisher_stderr"
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
@ -410,11 +410,11 @@ function __fisher_install
|
||||||
else
|
else
|
||||||
__fisher_log error "
|
__fisher_log error "
|
||||||
There was an error installing @$fetched@ or more plugin/s.
|
There was an error installing @$fetched@ or more plugin/s.
|
||||||
" $__fisher_stderr
|
" "$__fisher_stderr"
|
||||||
|
|
||||||
__fisher_log info "
|
__fisher_log info "
|
||||||
Try using a namespace before the plugin name: @xxx@/$fetched
|
Try using a namespace before the plugin name: @xxx@/$fetched
|
||||||
" $__fisher_stderr
|
" "$__fisher_stderr"
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
@ -440,23 +440,23 @@ function __fisher_plugin_fetch_items
|
||||||
set -l home ~
|
set -l home ~
|
||||||
set -l name (printf "%s\n" "$argv[1]" | command sed "s|$home|~|")
|
set -l name (printf "%s\n" "$argv[1]" | command sed "s|$home|~|")
|
||||||
|
|
||||||
__fisher_log info "Installing @""$name""@ " $__fisher_stderr
|
__fisher_log info "Installing @""$name""@ " "$__fisher_stderr"
|
||||||
else
|
else
|
||||||
set -l name (printf "%s\n" "$argv[1]" | command sed "s|$PWD/||")
|
set -l name (printf "%s\n" "$argv[1]" | command sed "s|$PWD/||")
|
||||||
|
|
||||||
__fisher_log info "Installing @""$name""@ " $__fisher_stderr
|
__fisher_log info "Installing @""$name""@ " "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
__fisher_log info "Installing @$count@ plugin/s" $__fisher_stderr
|
__fisher_log info "Installing @$count@ plugin/s" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
|
|
||||||
set -g __fisher_fetch_plugins_state "fetching"
|
set -g __fisher_fetch_plugins_state "fetching"
|
||||||
|
|
||||||
case "fetching"
|
case "fetching"
|
||||||
if test "$count" -eq 1
|
if test "$count" -eq 1
|
||||||
__fisher_log info "Installing @1@ dependency" $__fisher_stderr
|
__fisher_log info "Installing @1@ dependency" "$__fisher_stderr"
|
||||||
else
|
else
|
||||||
__fisher_log info "Installing @$count@ dependencies" $__fisher_stderr
|
__fisher_log info "Installing @$count@ dependencies" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
|
|
||||||
set -g __fisher_fetch_plugins_state "done"
|
set -g __fisher_fetch_plugins_state "done"
|
||||||
|
@ -493,7 +493,7 @@ function __fisher_plugin_fetch_items
|
||||||
if test -z "$names[2]"
|
if test -z "$names[2]"
|
||||||
if test -d "$src"
|
if test -d "$src"
|
||||||
if test ! -d "$fisher_config/$names[1]"
|
if test ! -d "$fisher_config/$names[1]"
|
||||||
__fisher_log info "Fetch @$names[1]@" $__fisher_stderr
|
__fisher_log info "Fetch @$names[1]@" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
|
|
||||||
if test -L "$src"
|
if test -L "$src"
|
||||||
|
@ -510,7 +510,7 @@ function __fisher_plugin_fetch_items
|
||||||
|
|
||||||
if test "$real_namespace" = "$names[2]"
|
if test "$real_namespace" = "$names[2]"
|
||||||
if test ! -d "$fisher_config/$names[1]"
|
if test ! -d "$fisher_config/$names[1]"
|
||||||
__fisher_log info "Fetch @$names[1]@" $__fisher_stderr
|
__fisher_log info "Fetch @$names[1]@" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
|
|
||||||
command cp -Rf "$src" "$fisher_config"
|
command cp -Rf "$src" "$fisher_config"
|
||||||
|
@ -598,9 +598,9 @@ function __fisher_update
|
||||||
end
|
end
|
||||||
|
|
||||||
if test "$count" -eq 1
|
if test "$count" -eq 1
|
||||||
__fisher_log info "Updating @$count@ plugin" $__fisher_stderr
|
__fisher_log info "Updating @$count@ plugin" "$__fisher_stderr"
|
||||||
else
|
else
|
||||||
__fisher_log info "Updating @$count@ plugins" $__fisher_stderr
|
__fisher_log info "Updating @$count@ plugins" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
|
|
||||||
for i in $argv
|
for i in $argv
|
||||||
|
@ -630,7 +630,7 @@ function __fisher_update
|
||||||
end
|
end
|
||||||
|
|
||||||
if test "$links" -gt 0
|
if test "$links" -gt 0
|
||||||
__fisher_log info "Synced @$links@ symlink/s" $__fisher_stderr
|
__fisher_log info "Synced @$links@ symlink/s" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -666,10 +666,10 @@ function __fisher_self_update
|
||||||
builtin source "$completions" ^ /dev/null
|
builtin source "$completions" ^ /dev/null
|
||||||
|
|
||||||
if test "$previous_version" = "$fisher_version"
|
if test "$previous_version" = "$fisher_version"
|
||||||
__fisher_log okay "fisherman is up to date" $__fisher_stderr
|
__fisher_log okay "fisherman is up to date" "$__fisher_stderr"
|
||||||
else
|
else
|
||||||
__fisher_log okay "You are running fisherman @$fisher_version@" $__fisher_stderr
|
__fisher_log okay "You are running fisherman @$fisher_version@" "$__fisher_stderr"
|
||||||
__fisher_log info "See github.com/fisherman/fisherman/releases" $__fisher_stderr
|
__fisher_log info "See github.com/fisherman/fisherman/releases" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ function __fisher_plugin_enable -a path
|
||||||
if test -e "$target" -a ! -L "$target"
|
if test -e "$target" -a ! -L "$target"
|
||||||
set -l backup_target "$fish_config/$dir/copy-$base"
|
set -l backup_target "$fish_config/$dir/copy-$base"
|
||||||
|
|
||||||
__fisher_log info "Save old @$base@" $__fisher_stderr
|
__fisher_log info "Save old @$base@" "$__fisher_stderr"
|
||||||
|
|
||||||
command mv "$target" "$backup_target" ^ /dev/stderr
|
command mv "$target" "$backup_target" ^ /dev/stderr
|
||||||
end
|
end
|
||||||
|
@ -912,7 +912,7 @@ function __fisher_remove
|
||||||
end
|
end
|
||||||
|
|
||||||
for i in $removed
|
for i in $removed
|
||||||
__fisher_log info "Remove @$i@" $__fisher_stderr
|
__fisher_log info "Remove @$i@" "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1261,13 +1261,13 @@ function __fisher_list_plugin_directory
|
||||||
|
|
||||||
for i in $argv
|
for i in $argv
|
||||||
if test ! -d "$fisher_config/$i"
|
if test ! -d "$fisher_config/$i"
|
||||||
__fisher_log error "You can only list plugins you've installed." $__fisher_stderr
|
__fisher_log error "You can only list plugins you've installed." "$__fisher_stderr"
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l fd $__fisher_stderr
|
set -l fd "$__fisher_stderr"
|
||||||
set -l uniq_items
|
set -l uniq_items
|
||||||
|
|
||||||
for i in $argv
|
for i in $argv
|
||||||
|
@ -1287,7 +1287,7 @@ function __fisher_list_plugin_directory
|
||||||
if contains -- --no-color $argv
|
if contains -- --no-color $argv
|
||||||
set color
|
set color
|
||||||
set nc
|
set nc
|
||||||
set fd $__fisher_stdout
|
set fd "$__fisher_stdout"
|
||||||
end
|
end
|
||||||
|
|
||||||
printf "$color%s$nc\n" "$PWD" > $fd
|
printf "$color%s$nc\n" "$PWD" > $fd
|
||||||
|
@ -1318,15 +1318,10 @@ end
|
||||||
|
|
||||||
|
|
||||||
function __fisher_log -a log message fd
|
function __fisher_log -a log message fd
|
||||||
if test -z "$log"
|
if test -z "$argv"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l nc (set_color normal)
|
|
||||||
set -l okay (set_color $fish_color_match)
|
|
||||||
set -l info (set_color $fish_color_match)
|
|
||||||
set -l error (set_color $fish_color_error)
|
|
||||||
|
|
||||||
switch "$fd"
|
switch "$fd"
|
||||||
case "/dev/null"
|
case "/dev/null"
|
||||||
return
|
return
|
||||||
|
@ -1341,6 +1336,11 @@ function __fisher_log -a log message fd
|
||||||
set error ""
|
set error ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
set -l nc (set_color normal)
|
||||||
|
set -l okay (set_color $fish_color_match)
|
||||||
|
set -l info (set_color $fish_color_match)
|
||||||
|
set -l error (set_color $fish_color_error)
|
||||||
|
|
||||||
printf "%s\n" "$message" | command awk '
|
printf "%s\n" "$message" | command awk '
|
||||||
function okay(s) {
|
function okay(s) {
|
||||||
printf("'"$okay"'%s'"$nc"' %s\n", "OK", s)
|
printf("'"$okay"'%s'"$nc"' %s\n", "OK", s)
|
||||||
|
@ -2081,13 +2081,13 @@ function __fisher_help -a cmd number
|
||||||
|
|
||||||
if not man "$page" ^ /dev/null
|
if not man "$page" ^ /dev/null
|
||||||
if test -d "$fisher_config/$cmd"
|
if test -d "$fisher_config/$cmd"
|
||||||
__fisher_log info "There's no manual for this plugin." $__fisher_stderr
|
__fisher_log info "There's no manual for this plugin." "$__fisher_stderr"
|
||||||
|
|
||||||
set -l url (__fisher_plugin_get_url_info -- "$fisher_config/$cmd")
|
set -l url (__fisher_plugin_get_url_info -- "$fisher_config/$cmd")
|
||||||
|
|
||||||
__fisher_log info "Try online: <@github.com/$url@>" $__fisher_stderr
|
__fisher_log info "Try online: <@github.com/$url@>" "$__fisher_stderr"
|
||||||
else
|
else
|
||||||
__fisher_log error "You can only check plugins you've installed." $__fisher_stderr
|
__fisher_log error "You can only check plugins you've installed." "$__fisher_stderr"
|
||||||
end
|
end
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
@ -2158,7 +2158,7 @@ function __fisher_self_uninstall -a yn
|
||||||
set -e fisher_version
|
set -e fisher_version
|
||||||
set -e fisher_spinners
|
set -e fisher_spinners
|
||||||
|
|
||||||
__fisher_log info "Done." $__fisher_stderr
|
__fisher_log info "Done." "$__fisher_stderr"
|
||||||
|
|
||||||
set -l funcs (functions -a | command grep __fisher)
|
set -l funcs (functions -a | command grep __fisher)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue