# Contributor: Andrej Kolčin <self@kaathewise.net>
# Maintainer: Andrej Kolčin <self@kaathewise.net>
pkgname=carapace
pkgver=1.3.1
pkgrel=0
pkgdesc="Multi-shell multi-command argument completer"
url="https://carapace.sh/"
arch="all"
license="MIT"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/rsteube/carapace-bin/archive/v$pkgver.tar.gz"
# fixes the tar archive unpacking to carapace-bin-$pkgver
_pkgname=carapace-bin
builddir="$srcdir/$_pkgname-$pkgver"
options="net"

build() {
	go generate ./cmd/carapace/...
	go build -tags release ./cmd/carapace
}

check() {
	# The three lone tests in the repository.
	go test \
		./cmd/carapace/... \
		./pkg/actions/tools/pandoc \
		./pkg/actions/env
}

package() {
	install -Dm755 carapace -t "$pkgdir"/usr/bin
	install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="
05e3026cb0494316be4b979f7ba77aa593919a8bd507825ca71ea3b8a2e497130acbaec640d9245c847902397813c1122b9d59912a6d0854dc3a0ed14f77f5b9  carapace-1.3.1.tar.gz
"
