# -*- 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 5e5ec3956dfc9b3b9593b77ad41f8267821149e6
github.tarball_from archive
version             20260619
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  02b513fec4ddb6223381e3758626bfa4b968042b \
                    sha256  1cb9435fc1e56d071a82332a84adf914e3844038e8f18232e5323ec407e18e63 \
                    size    14287373

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

use_configure       no

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

    # Point the main script at its libexec dir
    reinplace "s|^git_fuzzy_dir=.*|git_fuzzy_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 ${worksrcpath}/lib ${destroot}${prefix}/libexec/${name}/
}
