# -*- 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.3.1 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  cbdbdf2e0b2d86b36ab96cc7e86257e32a76be6c \
                sha256  ad1578915f793074fedd180fc2fb87390af9ee1a8ebf63d09e0af4a5fa4f1c4e \
                size    155249

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}
    }
}
