Use one jshon call for search results
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
aacf420a68
commit
96b7584153
17
prm
17
prm
|
@ -32,7 +32,7 @@ usage() {
|
|||
}
|
||||
|
||||
aur.search() {
|
||||
declare i aur_api_search_data aur_search_result_num aur_search_results version description
|
||||
declare i aur_api_search_data aur_search_result_num version description
|
||||
|
||||
aur_api_search_data=$( curl "${cfg_curl_opts[@]}" "${cfg_aur_api}&type=search&arg=${1}" )
|
||||
aur_search_result_num=$( jshon -e resultcount -u <<< "$aur_api_search_data" )
|
||||
|
@ -40,18 +40,13 @@ aur.search() {
|
|||
# Exit if nothing was found
|
||||
(( aur_search_result_num )) || { return 1; }
|
||||
|
||||
aur_search_results=( $( jshon -e results -a -e Name -u <<< "$aur_api_search_data" ) )
|
||||
|
||||
for i in "${!aur_search_results[@]}"; do
|
||||
{
|
||||
while {
|
||||
read -r name
|
||||
read -r version
|
||||
read -r description
|
||||
} < <(
|
||||
jshon -e results -e $i -e Version -u -p -e Description -u <<< "$aur_api_search_data"
|
||||
)
|
||||
|
||||
printf '%s %s\n %s\n' "aur/${aur_search_results[$i]}" "$version" "$description"
|
||||
done
|
||||
} do
|
||||
printf '%s %s\n %s\n' "aur/$name" "$version" "$description"
|
||||
done < <( jshon -C -e results -a -e Name -u -p -e Version -u -p -e Description -u <<< "$aur_api_search_data" )
|
||||
}
|
||||
|
||||
aur.info() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user