summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archweb.inc.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/archweb.inc.sh b/archweb.inc.sh
index 6075c41..fd88c59 100644
--- a/archweb.inc.sh
+++ b/archweb.inc.sh
@@ -1,4 +1,9 @@
archweb_get_pkgbase() {
- curl -Gs "https://www.archlinux.org/packages/search/json/" --data-urlencode "q=$1" |
- jq -er --arg pkgname "$1" 'limit(1; .results[] | select(.pkgname == $pkgname).pkgbase)'
+ local pkgbase
+
+ pkgbase=$(curl -Gs 'https://www.archlinux.org/packages/search/json/' --data-urlencode "q=$1" |
+ jq -r --arg pkgname "$1" 'limit(1; .results[] | select(.pkgname == $pkgname).pkgbase)')
+ [[ $pkgbase ]] || return
+
+ printf '%s\n' "$pkgbase"
}