# -*- 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

name             ondir
version          0.2.4
revision         0

categories       sysutils
platforms        darwin
license          GPL-2

maintainers      nomaintainer

description      Automatic script execution on cd
long_description OnDir is a program that automatically executes scripts as you traverse directories at a terminal.

homepage         https://swapoff.org/ondir.html
master_sites     https://swapoff.org/files/ondir/

checksums        rmd160         89f396a61987979d26a9726dda0f59a723790156 \
                 sha256         52921cdcf02273e0d47cc6172df6a0d2c56980d724568276acb0591e0bda343a \
                 size           52860

patchfiles       patch-Makefile.diff

post-patch {
    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/Makefile
}

use_configure    no

build.target     ondir

set docdir ${prefix}/share/doc/${name}

post-destroot {
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        AUTHORS COPYING ChangeLog README.rst ondirrc.eg scripts.sh scripts.tcsh scripts.zsh TODO \
        ${destroot}${docdir}
}

notes "
${docdir} contains docs and examples for fully configure ondir.

ondirrc.eg is a configuration example file; you can modify it and copy\
to ~/.ondirrc (per-user configuration) or to ${prefix}/etc/ondirrc\
(system-wide configuration).

Once you have installed OnDir, add either scripts.sh (for sh/bash),\
scripts.tcsh (for csh/tcsh) or scripts.zsh (for zsh) to your shell\
startup files. This will execute ondir whenever you change directories\
at the shell."