diff options
Diffstat (limited to 'archweb.inc.sh')
-rw-r--r-- | archweb.inc.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/archweb.inc.sh b/archweb.inc.sh new file mode 100644 index 0000000..b660c29 --- /dev/null +++ b/archweb.inc.sh @@ -0,0 +1,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" +} |