Make colour output configurable and output spaces instead of tabs
This commit is contained in:
parent
b6930851b8
commit
decae1b9a8
26
saury
26
saury
|
@ -42,14 +42,16 @@ end
|
||||||
|
|
||||||
function print_usage
|
function print_usage
|
||||||
function print_operation
|
function print_operation
|
||||||
echo -e "\t"(status -f) $argv
|
echo -e " "(status -f) $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
echo 'usage:' (status -f) '<operation> [...]'
|
echo 'usage:' (status -f) '[options] <operation> [...]'
|
||||||
echo 'operations:'
|
echo 'operations:'
|
||||||
print_operation "{-h --help}"
|
print_operation "{-h --help}"
|
||||||
print_operation "{-V --version}"
|
print_operation "{-V --version}"
|
||||||
print_operation "{-A --aur-sync} [options] [package(s)]"
|
print_operation "{-A --aur-sync} [options] [package(s)]"
|
||||||
|
echo 'options:'
|
||||||
|
echo ' --color <auto/always/never>'
|
||||||
end
|
end
|
||||||
|
|
||||||
function print_version
|
function print_version
|
||||||
|
@ -118,7 +120,7 @@ function aur_search
|
||||||
echo
|
echo
|
||||||
|
|
||||||
set_color normal
|
set_color normal
|
||||||
echo \t$description
|
echo " $description"
|
||||||
end
|
end
|
||||||
else if test "$rpc_response_type" = "error"
|
else if test "$rpc_response_type" = "error"
|
||||||
set rpc_error (echo $rpc_response | jq -r '.error')
|
set rpc_error (echo $rpc_response | jq -r '.error')
|
||||||
|
@ -134,8 +136,6 @@ function aur_sysupgrade
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_start
|
function on_start
|
||||||
tabs -4
|
|
||||||
|
|
||||||
# Detect 24-bit colour support
|
# Detect 24-bit colour support
|
||||||
# (Source: https://github.com/fish-shell/fish-shell/blob/619a248a3525b13ccd12f815cdb2d373e7372292/share/config.fish#L18)
|
# (Source: https://github.com/fish-shell/fish-shell/blob/619a248a3525b13ccd12f815cdb2d373e7372292/share/config.fish#L18)
|
||||||
if not set -q STY
|
if not set -q STY
|
||||||
|
@ -158,10 +158,6 @@ function on_start
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function on_exit
|
|
||||||
tabs -8
|
|
||||||
end
|
|
||||||
|
|
||||||
function main
|
function main
|
||||||
set -le argv
|
set -le argv
|
||||||
|
|
||||||
|
@ -169,7 +165,7 @@ function main
|
||||||
set aur_sync_exclusive_options 's,u'
|
set aur_sync_exclusive_options 's,u'
|
||||||
|
|
||||||
argparse -n $saury_name -x 'V,A' -x $aur_sync_exclusive_options \
|
argparse -n $saury_name -x 'V,A' -x $aur_sync_exclusive_options \
|
||||||
'h/help' 'V/version' 'A/aur-sync' $aur_sync_options -- $argv \
|
'h/help' 'V/version' 'A/aur-sync' 'c-color=?' $aur_sync_options -- $argv \
|
||||||
^| sed (string join '' '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 not set --local --query argv
|
||||||
|
@ -177,6 +173,15 @@ function main
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if set --query _flag_color
|
||||||
|
if test "$_flag_color" = "always"
|
||||||
|
functions -e set_color
|
||||||
|
else if test "$_flag_color" = "never"
|
||||||
|
function set_color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if set --query _flag_help
|
if set --query _flag_help
|
||||||
print_usage
|
print_usage
|
||||||
else if set --query _flag_version
|
else if set --query _flag_version
|
||||||
|
@ -200,4 +205,3 @@ end
|
||||||
|
|
||||||
on_start
|
on_start
|
||||||
main $argv
|
main $argv
|
||||||
on_exit
|
|
||||||
|
|
Loading…
Reference in New Issue