# -*- 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.50.2 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  0397506b5140fdde75cecdada46a1d214972ca09 \
                    sha256  86277c652d1568807a61236d1565bbe8b2280be4f11a6075a03cd7581469d355 \
                    size    3601614

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.\]+)
