# -*- 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        jonmosco kube-ps1 0.9.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0
categories          sysutils
platforms           {darwin any}
supported_archs     noarch
maintainers         {breun @breun} openmaintainer
license             Apache-2

description         Kubernetes prompt info for bash and zsh
long_description    A script that lets you add the current Kubernetes context and namespace \
                    configured on kubectl to your Bash/Zsh prompt strings (i.e. the \$PS1).

checksums           rmd160  1264feb645b03920523583b547a33ef95cd5a375 \
                    sha256  665f7cef9d941152ac809e09632127e5276e288b595e76b2d10e879993df689b \
                    size    512934

depends_run         path:${prefix}/bin/kubectl:kubectl-1.30

use_configure       no
build {}

destroot    {
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
    copy ${worksrcpath}/CHANGELOG.md \
        ${worksrcpath}/CONTRIBUTING.md \
        ${worksrcpath}/img \
        ${worksrcpath}/kube-ps1.sh \
        ${worksrcpath}/LICENSE \
        ${worksrcpath}/README.md \
        ${destroot}${prefix}/share/${name}
}

notes "
Source the kube-ps1.sh script and then use the kube_ps1 function in your shell prompt definition:

Bash example (~/.bashrc):

    source ${prefix}/share/${name}/kube-ps1.sh
    PS1=\'\$(kube_ps1)\'\$PS1

Zsh example (~/.zshrc):

    source ${prefix}/share/${name}/kube-ps1.sh
    PROMPT=\'\$(kube_ps1)\'\$PROMPT
"
