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

github.setup    gradle gradle-completion 9.8.0 v
revision        0

categories      devel
platforms       any
supported_archs noarch
license         MIT

maintainers     {mascguy @mascguy} \
                openmaintainer

description     Bash and Zsh completion support for Gradle
long_description \
    Bash and Zsh completion support for Gradle. For the former, this port requires \
    Bash >=4.1 and is meant to be used together with the Bash port.

github.tarball_from archive

checksums       rmd160  c7da2725500f5049ddf6fe221d136c57ee473cd7 \
                sha256  15672384608402919caf0d7c51e3b6675c006724b099045d21a269e8cb0b006d \
                size    170423

depends_run     port:gradle

use_configure   no

set gradle_compdir_bash \
    ${destroot}${prefix}/etc/bash_completion.d
set gradle_compdir_zsh \
    ${destroot}${prefix}/share/zsh/site-functions

set gradle_comp_bash \
    [list \
         gradle-completion.bash \
    ]

set gradle_comp_zsh \
    [list \
         _gradle \
    ]

build {}

pre-destroot {
    xinstall -d ${gradle_compdir_bash}
    xinstall -d ${gradle_compdir_zsh}
}

destroot {
    # Bash completions
    foreach f ${gradle_comp_bash} {
        xinstall -m 644 ${worksrcpath}/${f} \
            ${gradle_compdir_bash}/${f}
    }

    # Zsh completions
    foreach f ${gradle_comp_zsh} {
        xinstall -m 644 ${worksrcpath}/${f} \
            ${gradle_compdir_zsh}/${f}
    }
}
