maintainer="Kevin Daudt <kdaudt@alpinelinux.org>"
pkgname=k0sctl
pkgver=0.24.0
pkgrel=0
pkgdesc="Bootstrapping and management tool for k0s clusters"
url="https://github.com/k0sproject/k0sctl"
arch="all"
license="Apache-2.0"
makedepends="go"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/k0sproject/k0sctl/archive/refs/tags/v$pkgver/k0sctl-$pkgver.tar.gz"
options="net"

build() {
	make TAG_NAME="v$pkgver" GIT_COMMIT=""

	for shell in bash fish zsh; do
		./$pkgname completion --shell $shell >$pkgname.$shell
	done
}

check() {
	make test
}

package() {
	make PREFIX=/usr DESTDIR="$pkgdir" install

	install -Dm644 $pkgname.bash "$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 $pkgname.fish "$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
	install -Dm644 $pkgname.zsh "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
99e1bbe1d5197319b732c83244d6fb84ff82fb6f10d96234c925b068070dcfa30033eabf0dcf0b2f7474c5574138e65fc62601f1040f54bc0d667b74dbda389f  k0sctl-0.24.0.tar.gz
"
