mirror of
https://github.com/jorgebucaran/fisher
synced 2024-10-09 09:36:53 +02:00
Early exit __fisher_log if no log command is given.
This commit is contained in:
parent
c27de1f20d
commit
f784dace49
1 changed files with 8 additions and 4 deletions
12
fisher.fish
12
fisher.fish
|
@ -1319,6 +1319,10 @@ end
|
||||||
|
|
||||||
|
|
||||||
function __fisher_log -a log message fd
|
function __fisher_log -a log message fd
|
||||||
|
if test -z "$log"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
set -l nc (set_color normal)
|
set -l nc (set_color normal)
|
||||||
set -l okay (set_color $fish_color_match)
|
set -l okay (set_color $fish_color_match)
|
||||||
set -l info (set_color $fish_color_match)
|
set -l info (set_color $fish_color_match)
|
||||||
|
@ -1340,7 +1344,7 @@ function __fisher_log -a log message fd
|
||||||
|
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
function info(s) {
|
function info(s) {
|
||||||
|
@ -1348,7 +1352,7 @@ function __fisher_log -a log message fd
|
||||||
}
|
}
|
||||||
|
|
||||||
function error(s) {
|
function error(s) {
|
||||||
printf("'$error'%s'$nc' %s\n", "!", s)
|
printf("'"$error"'%s'"$nc"' %s\n", "!", s)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1358,7 +1362,7 @@ function __fisher_log -a log message fd
|
||||||
if (/@[^@]+@/) {
|
if (/@[^@]+@/) {
|
||||||
n = match($0, /@[^@]+@/)
|
n = match($0, /@[^@]+@/)
|
||||||
if (n) {
|
if (n) {
|
||||||
sub(/@[^@]+@/, "'"$$log"'" substr($0, RSTART + 1, RLENGTH - 2) "'$nc'", $0)
|
sub(/@[^@]+@/, "'"$$log"'" substr($0, RSTART + 1, RLENGTH - 2) "'"$nc"'", $0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1374,7 +1378,7 @@ function __fisher_log -a log message fd
|
||||||
if (s[i] == "") {
|
if (s[i] == "") {
|
||||||
print
|
print
|
||||||
} else {
|
} else {
|
||||||
'$log'(s[i])
|
'"$log"'(s[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue