From b233aceb92aed4fcdd6a918647c32c915d4fcc71 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 25 Nov 2017 17:35:47 -0500 Subject: archweb: use jq's -e flag to indicate not-found as failure --- archweb.inc.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/archweb.inc.sh b/archweb.inc.sh index 15f0442..dbe36a5 100644 --- a/archweb.inc.sh +++ b/archweb.inc.sh @@ -1,9 +1,4 @@ archweb_get_pkgbase() { - local pkgbase - - pkgbase=$(curl -s "https://www.archlinux.org/packages/search/json/?q=$1" | - jq -r --arg pkgname "$1" 'limit(1; .results[] | select(.pkgname == $pkgname).pkgbase)') - [[ $pkgbase ]] || return - - printf '%s\n' "$pkgbase" + curl -s "https://www.archlinux.org/packages/search/json/?q=$1" | + jq -er --arg pkgname "$1" 'limit(1; .results[] | select(.pkgname == $pkgname).pkgbase)' } -- cgit v1.2.3-70-g09d2