# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           golang 1.0

go.setup            github.com/nickawilliams/diffscribe 0.1.0 v
go.offline_build    no

categories          devel
license             BSD
maintainers         {@nickawilliams users.noreply.github.com:nickawilliams} openmaintainer

description         Ask an LLM to craft helpful Conventional Commit messages for your staged Git changes.
long_description    {*}${description}
homepage            https://github.com/nickawilliams/diffscribe

checksums           rmd160  e78cbbd76d8357d4a79c3f6e39cd8a1018bed667 \
                    sha256  e89c2358175916f788fb2f238586b1ee521ee1001b63d75d900d67916a432690 \
                    size    114351

build.env-append    CGO_ENABLED=0
build.args          -o ${worksrcpath}/${name} \
                    -trimpath \
                    -ldflags \" \
                        -s \
                        -w \
                        -X github.com/nickawilliams/diffscribe/internal/version.version=${version} \
                    \" \
                    ./

post-build {
    system -W ${worksrcpath} "CGO_ENABLED=0 ${go.bin} run ./tools/gen-man"
}

test.run            yes
test.cmd            ${worksrcpath}/${name}
test.args           --version

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/${name}

    xinstall -d ${destroot}${prefix}/share/bash-completion/completions
    xinstall -m 0644 ${worksrcpath}/contrib/completions/bash/${name}.bash \
        ${destroot}${prefix}/share/bash-completion/completions/${name}

    xinstall -d ${destroot}${prefix}/share/fish/vendor_completions.d
    xinstall -m 0644 ${worksrcpath}/contrib/completions/fish/${name}.fish \
        ${destroot}${prefix}/share/fish/vendor_completions.d/${name}.fish

    xinstall -d ${destroot}${prefix}/share/zsh/site-functions
    xinstall -m 0644 ${worksrcpath}/contrib/completions/zsh/${name}.zsh \
        ${destroot}${prefix}/share/zsh/site-functions/_${name}

    if {[file exists ${worksrcpath}/contrib/man/${name}.1]} {
        xinstall -d ${destroot}${prefix}/share/man/man1
        xinstall -m 0644 ${worksrcpath}/contrib/man/${name}.1 \
            ${destroot}${prefix}/share/man/man1/${name}.1
    }
}
