summaryrefslogtreecommitdiff
path: root/archweb.inc.sh
blob: 15f0442341100b9414d5b8add0199c230f9ffa7c (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

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