# Contributor: 6543 <6543@obermui.de>
# Maintainer: 6543 <6543@obermui.de>
pkgname=tea
pkgver=0.9.2
pkgrel=11
pkgdesc="A command line tool to interact with Gitea servers"
url="https://gitea.com/gitea/tea"
license="MIT"
arch="all"
makedepends="go"
subpackages="$pkgname-bash-completion"
source="$pkgname-$pkgver-2.tar.gz::https://gitea.com/gitea/tea/archive/v$pkgver.tar.gz
	bash_autocomplete
	"
builddir="$srcdir/$pkgname"
options="chmod-clean"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	local sdk=$(go list -f '{{.Version}}' -m code.gitea.io/sdk/gitea)

	go build -ldflags "-X main.Version=$pkgver -X main.SDK=$sdk" -o $pkgname
}

check() {
	go test ./...
}

package() {
	install -Dm755 "$builddir"/$pkgname "$pkgdir"/usr/bin/$pkgname
	install -Dm644 "$srcdir"/bash_autocomplete "$pkgdir"/usr/share/bash-completion/completions/tea
}

sha512sums="
05be2ea5f845773324c10fe8f0340c96f40f392b7ef8cafb44463b7a5492de2216799d8cc339e7dc42e921afcd3ba0e21be133a87385e907af47261733935e62  tea-0.9.2-2.tar.gz
d89c90cde59ec43c0ff3eb9db9928cbb8be765e264eff8dabf2889507a5fe5d4799d89a7b02832c11954d684f232e1265f4aa740c9c5e26954d2ac8f7d4a7a57  bash_autocomplete
"
