# -*- 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/noborus/ov 0.40.0 v
go.offline_build    no
revision            0

description         Feature rich terminal pager

long_description    ov is a feature rich terminal pager. It has an effective \
                    function for tabular text. Previously known as oviewer.

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

checksums           rmd160  f39bd3c7d274163bc2dbabdf3f3ef314b67f13bd \
                    sha256  8f2c8f1246d6fd1affee3d9570a7a085c8c608d3a710829d5097fca0e53290a0 \
                    size    3581833

build.cmd           make
build.pre_args-append \
                    LDFLAGS="\\\"-X main.Version=${version}\\\""
build.args          build

post-build {
    set ov ${worksrcpath}/${name}

    set bash_completions_dir ${worksrcpath}/share/bash-completion/completions
    set fish_completions_dir ${worksrcpath}/share/fish/vendor_completions.d
    set zsh_completions_dir ${worksrcpath}/share/zsh/site-functions

    xinstall -d ${bash_completions_dir} ${fish_completions_dir} ${zsh_completions_dir}

    system "${ov} --completion bash > ${bash_completions_dir}/${name}"
    system "${ov} --completion fish > ${fish_completions_dir}/${name}.fish"
    system "${ov} --completion zsh > ${zsh_completions_dir}/_${name}"
}

set ov_share_path   ${prefix}/share/${name}

destroot {
    xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/
    xinstall -d ${destroot}${ov_share_path}/
    xinstall -m 0644 ${worksrcpath}/${name}.yaml ${destroot}${ov_share_path}/

    set bash_completions_dir share/bash-completion/completions
    set fish_completions_dir share/fish/vendor_completions.d
    set zsh_completions_dir share/zsh/site-functions

    xinstall -d ${destroot}${prefix}/${bash_completions_dir}
    xinstall ${worksrcpath}/${bash_completions_dir}/${name} \
        ${destroot}${prefix}/${bash_completions_dir}

    xinstall -d ${destroot}${prefix}/${fish_completions_dir}
    xinstall ${worksrcpath}/${fish_completions_dir}/${name}.fish \
        ${destroot}${prefix}/${fish_completions_dir}

    xinstall -d ${destroot}${prefix}/${zsh_completions_dir}
    xinstall ${worksrcpath}/${zsh_completions_dir}/_${name} \
        ${destroot}${prefix}/${zsh_completions_dir}
}

notes "
    You can find a sample config file for ov at: ${ov_share_path}/${name}.yaml
"

github.livecheck.regex (\[0-9.\]+)
