Sort search results by votes and package name

This commit is contained in:
Les De Ridder 2019-03-24 07:59:40 +01:00
parent 890ab32084
commit 8448bae508
1 changed files with 1 additions and 1 deletions

2
saury
View File

@ -75,7 +75,7 @@ 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 | 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)]