summaryrefslogtreecommitdiff
path: root/archweb.inc.sh
blob: fd88c59a8f0b420555ad87c0ea080595e2b2ca25 (plain)
1
2
3
4
5
6
7
8
9
archweb_get_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"
}