# -*- 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/bmf-san/ggc 8.7.2 v
go.offline_build    no
go.toolchain_min    1.25.0
revision            0

description         \
    A modern Git CLI tool with both traditional command-line and interactive \
    incremental-search UI.

long_description    \
    ${name} is a Git tool written in Go, offering both traditional CLI \
    commands and an interactive interface with incremental search. You can \
    either run subcommands like ggc add directly, or launch the interactive \
    mode by simply typing ggc. Designed to be fast, user-friendly, and \
    extensible.

categories          devel
installs_libs       no
license             MIT
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  ea9eb89f50d2f81b7aafed8f9684b78c82192929 \
                    sha256  baeff020de9cb5ced3da94d50805727071c9faa5bc06089b14404430f95b9334 \
                    size    4887638

build.args-append   \
    -ldflags \" -X main.version=${version} \"

post-build {
    foreach shell {bash fish zsh} {
        system -W ${worksrcpath} \
            "./${name} completion ${shell} > ${worksrcpath}/${name}.${shell}"
    }
}

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/
    # Check ${worksrcpath}/tools/completions/ for all supported shells
    set comp_path(bash) ${destroot}${prefix}/share/bash-completion/completions/${name}
    set comp_path(fish) ${destroot}${prefix}/share/fish/completions/${name}.fish
    set comp_path(zsh)  ${destroot}${prefix}/share/zsh/site-functions/_${name}
    foreach shell {bash fish zsh} {
        xinstall -d [file dirname $comp_path(${shell})]
        xinstall -m 0644 ${worksrcpath}/${name}.${shell} $comp_path(${shell})
    }
}
