# -*- 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           github 1.0

name                maven-completion
github.setup        juven maven-bash-completion 216cd667b6119fe200c98b1ac2d030ac002be197
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             20200421
revision            0

categories          java
platforms           any
supported_archs     noarch
license             Apache-2

maintainers         {mascguy @mascguy} openmaintainer

description         Bash completions for Maven
long_description    {*}${description}

checksums           rmd160  60cd47833b3739b49480f62e97335cbf9f796762 \
                    sha256  82260455bc7df6f68e119e270a889c9db3e0a45a02f0da6dd0be6a6f9c41c505 \
                    size    260249

depends_run         port:bash

use_configure       no

set compdir_bash \
    ${destroot}${prefix}/etc/bash_completion.d

set doc_dir \
    ${destroot}${prefix}/share/doc/${subport}

set doc_files \
    [list \
        LICENSE \
        readme.md \
        demo.gif \
    ]

build {}

pre-destroot {
    xinstall -d ${doc_dir}
    xinstall -d ${compdir_bash}
}

destroot {
    set my_completions \
        [glob -nocomplain -type f \
            -directory ${worksrcpath} \
            *]

    foreach fpath ${my_completions} {
        set fn [file tail ${fpath}]

        if {[lsearch -exact ${doc_files} ${fn}] < 0} {
            xinstall -m 644 ${fpath} \
                ${compdir_bash}/${fn}
        } else {
            xinstall -m 644 ${fpath} \
                ${doc_dir}/${fn}
        }
    }
}

