# -*- 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/cheat/cheat 5.1.0
go.offline_build    no
go.toolchain_min    1.26
revision            0

description         create and view interactive cheatsheets on the command-line

long_description    ${name} allows you to {*}${description}. It was designed \
                    to help remind *nix system administrators of options for \
                    commands that they use frequently, but not frequently \
                    enough to remember.

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

checksums           rmd160  20f3b7fdc1690b24bf8491d118b1955ca0c2e63a \
                    sha256  5ef8864dacb5b37268d7d26cd01f74b99a33b2e5eb5b290e4221358410c99db4 \
                    size    3442396

build.pre_args-append \
     -ldflags="-s -w" -trimpath
build.args          ./cmd/${name}

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

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/
    xinstall -m 0755 ${worksrcpath}/scripts/git/cheatsheets \
        ${destroot}${prefix}/bin/

    xinstall -d ${destroot}${prefix}/share/man/man1/
    xinstall -m 0644 ${worksrcpath}/doc/${name}.1 \
        ${destroot}${prefix}/share/man/man1/

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

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

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