# Template file for 'prek'
pkgname=prek
version=0.4.5
revision=1
build_style=cargo
build_helper=qemu
configure_args="--no-default-features"
make_install_args="--path crates/prek"
make_check_args="--
 --skip bun:: --skip haskell:: --skip lua:: --skip node:: --skip pygrep::
 --skip python:: --skip ruby:: --skip script:: --skip golang:: --skip julia::
 --skip swift:: --skip rust:: --skip languages:: --skip deno:: --skip dart::
 --skip perl:: --skip r:: --skip conda:: --skip coursier::"
depends="git"
checkdepends="git python3"
short_desc="Framework for running git pre-commit hooks"
maintainer="Alex March <alex@hosaka.cc>"
license="MIT"
homepage="https://prek.j178.dev"
changelog="https://raw.githubusercontent.com/j178/prek/refs/heads/master/CHANGELOG.md"
distfiles="https://github.com/j178/prek/archive/refs/tags/v${version}.tar.gz"
checksum=16126573633d4b1f1034a2a96ac7d628784e85ce3a82dc08bbd7301718259fd8

post_install() {
	for shell in bash fish zsh; do
		COMPLETE="${shell}" vtargetrun "${DESTDIR}/usr/bin/prek" > "prek.${shell}"
		# remove DESTDIR prefix from absolute paths that are set inside the shell
		# completion file, i.e. ${DESTDIR}/usr/bin/prek -> /usr/bin/prek
		vsed -i "s@${DESTDIR}@@g" "prek.${shell}"
		vcompletion "prek.${shell}" "${shell}"
	done

	vlicense LICENSE
}
