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

  printf '%s\n' "$pkgbase"
}