# -*- 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/alajmo/mani 0.31.0 v
revision            0

homepage            https://manicli.com

description         CLI tool to help you manage repositories

long_description    \
    ${name} is a CLI tool that helps you manage multiple repositories. It's \
    useful when you are working with microservices, multi-project systems, \
    many libraries or just a bunch of repositories and want a central place \
    for pulling all repositories and running commands over them. You specify \
    repository and commands in a config file and then run the commands over \
    all or a subset of the repositories.

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

checksums           rmd160  f20f4720156a7ce2bd6e7a32e2bd23e04a4739fa \
                    sha256  dd44bd7f409c5b2a755beca45229cbc9be02712be55c099bd6a01f6cc3441df2 \
                    size    925425

# Allow Go to fetch deps at build time
go.offline_build no

build.cmd           make
build.pre_args      DATE=""
build.args          build

post-build {
    # Generate shell completions for supported shells
    foreach shell {bash fish zsh} {
        system -W ${worksrcpath}/dist \
            "./${name} completion ${shell} > ${name}.${shell}"
    }
}

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

    set bash_comp_path ${destroot}${prefix}/share/bash-completion/completions
    xinstall -m 0755 -d ${bash_comp_path}
    xinstall -m 0644 ${worksrcpath}/dist/${name}.bash ${bash_comp_path}/${name}

    set fish_comp_path ${destroot}${prefix}/share/fish/vendor_completions.d
    xinstall -m 0755 -d ${fish_comp_path}
    xinstall -m 0644 ${worksrcpath}/dist/${name}.fish ${fish_comp_path}

    set zsh_comp_path ${destroot}${prefix}/share/zsh/site-functions
    xinstall -m 0755 -d ${zsh_comp_path}
    xinstall -m 0644 ${worksrcpath}/dist/${name}.zsh ${zsh_comp_path}/_${name}

    xinstall -m 0755 -d ${destroot}${prefix}/share/man/man1
    xinstall -m 0444 ${worksrcpath}/core/mani.1 ${destroot}${prefix}/share/man/man1
}
