# Contributor: guddaff <alpine@guddaff.de>
# Maintainer: guddaff <alpine@guddaff.de>
pkgname=mqttui
pkgver=0.22.1
pkgrel=0
pkgdesc="Subscribe to a MQTT Topic or publish something quickly from the terminal"
url="https://github.com/EdJoPaTo/mqttui"
arch="all"
license="GPL-3.0-or-later"
makedepends="cargo cargo-auditable"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/EdJoPaTo/mqttui/archive/v$pkgver/mqttui-$pkgver.tar.gz"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/mqttui -t "$pkgdir"/usr/bin/

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

sha512sums="
66733d5f265444d704287bc96f5c9378dd5b56be3759722ba4f1218c1e9de97aff8b098fd023e0583db16430c2df54ba474da21190e92197e8b5d735416d4793  mqttui-0.22.1.tar.gz
"
