# -*- 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        bigH git-fuzzy 6bf6db61d3bd9a16203130587ccfbc02f4ca9a57
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             20210729
revision            0

description         interactive `git` with the help of `fzf`

long_description    {*}${description}. You can run git add and git reset by \
                    selecting or cursoring. You can commit interactively.

categories          devel
installs_libs       no
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer
license             MIT
supported_archs     noarch
platforms           any

checksums           rmd160  02f75f3a74220c3c928b3fabaabdb4e5858981d5 \
                    sha256  07f1ee8c60ada136ba6cb7dea226b159ace64c22b21864c2f0c57fef223b286b \
                    size    14271377

depends_run-append  port:bash       \
                    port:bat        \
                    port:exa        \
                    port:fzf        \
                    port:git-delta

use_configure       no

patch {
    # Use MacPorts bash
    reinplace "s|#!/usr/bin/env bash|#!${prefix}/bin/bash|" \
        ${worksrcpath}/bin/${name}

    # Set main script's source path to its libexec dir
    reinplace "s|^lib_dir=.*|lib_dir=\"${prefix}/libexec/${name}\"|" \
        ${worksrcpath}/bin/${name}
}

build {}

destroot {
    xinstall -m 0755 ${worksrcpath}/bin/${name} ${destroot}${prefix}/bin/
    xinstall -d ${destroot}${prefix}/libexec/${name}
    copy {*}[glob ${worksrcpath}/lib/*] ${destroot}${prefix}/libexec/${name}/
}
