Don't output colours when stdout isn't connected to a terminal
This commit is contained in:
parent
16c9c6eb3e
commit
b6930851b8
18
saury
18
saury
|
@ -90,7 +90,9 @@ function aur_search
|
|||
set popularity $results[(math $i \* 7)]
|
||||
|
||||
set_color --bold
|
||||
echo -n (set_color CC3399)aur/(set_color normal; set_color --bold)$name
|
||||
echo -n (string join "" \
|
||||
(set_color CC3399) "aur/" \
|
||||
(set_color normal; set_color --bold) "$name")
|
||||
echo -n ' '
|
||||
|
||||
if test $out_of_date = "true"
|
||||
|
@ -106,7 +108,12 @@ function aur_search
|
|||
echo -n " ($package_base)"
|
||||
end
|
||||
|
||||
echo -n (set_color normal; set_color --bold)' ('(set_color CC6733)"+$votes"(set_color normal; set_color --bold)' | '(set_color CC6733)$popularity(set_color normal; set_color --bold)')'
|
||||
echo -n (string join "" \
|
||||
(set_color normal; set_color --bold) ' (' \
|
||||
(set_color CC6733) "+$votes" \
|
||||
(set_color normal; set_color --bold) ' | ' \
|
||||
(set_color CC6733) "$popularity" \
|
||||
(set_color normal; set_color --bold) ')')
|
||||
|
||||
echo
|
||||
|
||||
|
@ -144,6 +151,11 @@ function on_start
|
|||
set -q fish_term24bit
|
||||
or set -g fish_term24bit 1
|
||||
end
|
||||
|
||||
if not test -t 1
|
||||
function set_color
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function on_exit
|
||||
|
@ -158,7 +170,7 @@ function main
|
|||
|
||||
argparse -n $saury_name -x 'V,A' -x $aur_sync_exclusive_options \
|
||||
'h/help' 'V/version' 'A/aur-sync' $aur_sync_options -- $argv \
|
||||
^| sed 's/:/':(set_color red)'/;s/$/'(set_color normal)'/' | head -1
|
||||
^| sed (string join '' 's/:/:' (set_color red) '/;s/$/' (set_color normal) '/') | head -1
|
||||
|
||||
if not set --local --query argv
|
||||
# if argparse didn't locally set $argv, it encountered an error
|
||||
|
|
Loading…
Reference in New Issue