Use one jshon call for search results
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
aacf420a68
commit
96b7584153
21
prm
21
prm
|
@ -32,7 +32,7 @@ usage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
aur.search() {
|
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_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" )
|
aur_search_result_num=$( jshon -e resultcount -u <<< "$aur_api_search_data" )
|
||||||
|
@ -40,18 +40,13 @@ aur.search() {
|
||||||
# Exit if nothing was found
|
# Exit if nothing was found
|
||||||
(( aur_search_result_num )) || { return 1; }
|
(( aur_search_result_num )) || { return 1; }
|
||||||
|
|
||||||
aur_search_results=( $( jshon -e results -a -e Name -u <<< "$aur_api_search_data" ) )
|
while {
|
||||||
|
read -r name
|
||||||
for i in "${!aur_search_results[@]}"; do
|
read -r version
|
||||||
{
|
read -r description
|
||||||
read -r version
|
} do
|
||||||
read -r description
|
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" )
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aur.info() {
|
aur.info() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user