# Template file for 'tombi'
pkgname=tombi
version=1.2.0
revision=1
build_style=cargo
build_wrksrc="rust/tombi-cli"
build_helper="qemu"
short_desc="TOML Formatter, Linter and Language Server"
maintainer="Bnyro <bnyro@tutanota.com>"
license="MIT"
homepage="https://tombi-toml.github.io/tombi/"
changelog="https://github.com/tombi-toml/tombi/releases"
distfiles="https://github.com/tombi-toml/tombi/archive/refs/tags/v${version}.tar.gz"
checksum=207dd1e3febd28a970f99da140f375d60fd838d0017e0f641648b6b5b77cbc3f

export __TOMBI_VERSION=${version}
export __TOMBI_TARGET_TRIPLE=${XBPS_RUST_TARGET}

post_patch() {
	# build.rs only tries to set the version to the commit hash
	# we set it directly via __TOMBI_VERSION instead
	rm build.rs
}

post_install() {
	vlicense ../../LICENSE

	for _shell in bash fish zsh; do
		vtargetrun ${DESTDIR}/usr/bin/tombi completion ${_shell} > tombi.${_shell}
		vcompletion tombi.${_shell} ${_shell}
	done
}
