diff --git a/saury b/saury index 7e60fc5..db3c18e 100755 --- a/saury +++ b/saury @@ -75,7 +75,10 @@ function aur_search set rpc_response_type (echo $rpc_response | jq -r '.type') if test "$rpc_response_type" = "search" - set results (echo $rpc_response | jq -r '.results | sort_by(.NumVotes, (.Name | explode | map(-.))) | reverse | map(.Name, .PackageBase, .Description, .Version, .OutOfDate != null, .NumVotes, (.Popularity * 100 | round / 100))[]') + set results (echo $rpc_response | \ + jq -r '.results | sort_by(.NumVotes, (.Name | explode | map(-.))) | reverse | + map(.Name, .PackageBase, .Description, .Version, + .OutOfDate != null, .NumVotes, (.Popularity * 100 | round / 100))[]') for i in (seq (math (count $results) / 7)) set name $results[(math $i \* 7 - 6)] @@ -90,7 +93,11 @@ function aur_search echo -n (set_color CC3399)aur/(set_color normal; set_color --bold)$name echo -n ' ' - if test $out_of_date = "true"; set_color CC334D; else; set_color 33CC66; end + if test $out_of_date = "true" + set_color CC334D + else + set_color 33CC66 + end echo -n $package_version if test "$name" != "$package_base" @@ -99,7 +106,6 @@ function aur_search echo -n " ($package_base)" end - set -x fish_term24bit 1 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 @@ -149,8 +155,15 @@ function main set aur_sync_options 's/search' 'u/sysupgrade' set aur_sync_exclusive_options 's,u' - 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 - if not set --local --query argv; exit 1; end + + 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 + + if not set --local --query argv + # if argparse didn't locally set $argv, it encountered an error + exit 1 + end if set --query _flag_help print_usage