# -*- 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.6.4 v
go.offline_build    no
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  dab2aa642164442f42daecc2232c0ebff7b3649d \
                    sha256  cd0b2abf2eb20b2c258a82062597bf5b76f82c9702f665f5db5c3056dcbe8074 \
                    size    4907825

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})
    }
}
