# Template file for 'typstyle'
pkgname=typstyle
version=0.15.0
revision=1
build_style=cargo
build_helper=qemu
configure_args="--no-default-features --features=completion"
make_install_args="--path crates/typstyle"
make_check_args="-- --skip all_0_check" # broken upstream
checkdepends="git"
short_desc="Beautiful and reliable typst code formatter"
maintainer="Bnyro <bnyro@tutanota.com>"
license="Apache-2.0"
homepage="https://github.com/Enter-tainer/typstyle/"
changelog="https://raw.githubusercontent.com/Enter-tainer/typstyle/master/CHANGELOG.md"
distfiles="https://github.com/Enter-tainer/typstyle/archive/refs/tags/v${version}.tar.gz"
checksum=23dd94b7a3f0e5ca40827d3998cc9669457a6aad80a6e70bbb886111734dab3f

if [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
	make_check=no # reflexo crate for tests not running on i686
fi

post_install() {
	local typstyle="${DESTDIR}/usr/bin/typstyle"
	for shell in bash zsh fish; do
		vtargetrun "${typstyle}" completions ${shell} > completion.${shell}
		vcompletion completion.${shell} ${shell}
	done
}
