Show versions in AUR searches, less jshon calls, read -r

This commit is contained in:
Jack L. Frost 2015-02-03 12:58:00 +03:00
parent b68c7c5949
commit d1becc7836

25
zpac
View File

@ -35,7 +35,14 @@ aur.search() {
aur_search_results=( $( jshon -e results -a -e Name -u <<< "$aur_api_search_data" ) )
for i in "${!aur_search_results[@]}"; do
printf 'aur/%s\n %s\n' "${aur_search_results[${i}]}" "$( jshon -e results -e $i -e Description -u <<< "$aur_api_search_data" )"
{
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
else
return 1
@ -56,10 +63,14 @@ aur.info() {
aur.get() {
local dep_name aur_api_multireq aur_deps_api_data aur_deps_count aur_deps pkg_aur_info pkg_base tarball_path
read pkg_aur_info
read -r pkg_aur_info
pkg_base=$( jshon -e results -e PackageBase -u <<< "$pkg_aur_info" )
tarball_path=$( jshon -e results -e URLPath -u <<< "$pkg_aur_info" )
{
read -r pkg_base
read -r tarball_path
} < <(
jshon -e results -e PackageBase -u -p -e URLPath -u <<< "$pkg_aur_info"
)
cd "$cfg_workdir"
@ -120,7 +131,7 @@ args_norm() {
--) printf '%s\n' '--'; break;;
--*)
IFS='=' read arg opt <<< "$1"
IFS='=' read -r arg opt <<< "$1"
printf '%s\n' "$arg"
[[ "$opt" ]] && {
@ -129,7 +140,7 @@ args_norm() {
;;
-*)
while read -n1 c
while read -r -n1 c
do
case "$c" in
-|'') :;;
@ -213,7 +224,7 @@ main() {
if (( ! "$?" )); then
repo='aur'
else
while read; do
while read -r; do
if [[ "$REPLY" =~ ^Repository ]]; then
repo="${REPLY##* }"
fi