# -*- 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           python 1.0
PortGroup           github 1.0

github.setup        wting autojump 22.5.3 release-v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            5

categories-prepend  sysutils
maintainers         nomaintainer
license             GPL-3+
supported_archs     noarch
platforms           any

description         a cd command that learns
long_description    ${name} is {*}${description}.

checksums           rmd160  3d4feaf96158b76cb94a14049c1a81108b2bb4f4 \
                    sha256  00e86809cef2529d77ff8ed88fa59910024411e9e6594ddb042ae1e0eda5aaae \
                    size    55445

python.default_version 314
python.pep517       no

post-patch {
    reinplace "s:/usr/bin/env python:${python.bin}:g" ${worksrcpath}/bin/autojump
}

build {}

destroot.cmd    ${python.bin} install.py
destroot.args   --force
destroot.target {}
destroot.destdir --destdir=${destroot}${prefix} --zshshare=${destroot}${prefix}/share/zsh/site-functions

post-destroot {
    reinplace "s:${destroot}${prefix}:${prefix}:g" ${destroot}${prefix}/etc/profile.d/autojump.sh
}

test.run        yes

depends_test-append \
                port:py${python.version}-mock

notes "
To use autojump for bash, add the following to the end of your .bashrc:

if \[ -f ${prefix}/etc/profile.d/autojump.sh \]; then
    . ${prefix}/etc/profile.d/autojump.sh
fi

To use autojump for zsh, add the following to the end of your .zshrc:

export FPATH=\"\$FPATH:${prefix}/share/zsh/site-functions/\"
if \[ -f ${prefix}/etc/profile.d/autojump.sh \]; then
    . ${prefix}/etc/profile.d/autojump.sh
fi

To use zsh tab completion, load compinit in your .zshrc:

autoload -U compinit; compinit
"
