# Maintainer: Lauri Tirkkonen <lauri@hacktheplanet.fi>
pkgname=kubie
pkgver=0.24.0
pkgrel=0
pkgdesc="A more powerful alternative to kubectx and kubens"
url="https://github.com/sbstp/kubie"
# loongarch64, s390x: fails to build nix crate
arch="all !loongarch64 !s390x"
license="Zlib"
subpackages="$pkgname-bash-completion $pkgname-fish-completion"
makedepends="
	cargo
	cargo-auditable
	"
source="v$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release --no-default-features
}

check() {
	cargo test --frozen
}

package() {
	install -D -m 0755 target/release/$pkgname "$pkgdir"/usr/bin/$pkgname

	install -Dm644 completion/$pkgname.bash \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname

	install -Dm644 completion/$pkgname.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
}

sha512sums="
4ab7c677dd8d252cca2383e0de2e46a3a5229ebd6f135eab63be0809965aa7d42f5e4b9e90214d917f014a9fc036c3407e4c9f96191df62764a06d974d8f5fda  v0.24.0.tar.gz
"
