summaryrefslogtreecommitdiff
path: root/archweb.inc.sh
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2017-11-25 17:35:47 -0500
committerDave Reisner <dreisner@archlinux.org>2017-11-26 11:35:44 -0500
commitb233aceb92aed4fcdd6a918647c32c915d4fcc71 (patch)
treedf3fbf395e5e88514340b28cb37730b02c7a7704 /archweb.inc.sh
parent22f079869b7586bcef4b77b6601376be2bd1e61d (diff)
downloadasp32-b233aceb92aed4fcdd6a918647c32c915d4fcc71.tar.xz
archweb: use jq's -e flag to indicate not-found as failure
Diffstat (limited to 'archweb.inc.sh')
-rw-r--r--archweb.inc.sh9
1 files 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)'
}