#!/bin/sh

test $(basename $0) = 'work-sh' &&
cat <<-EOF && exit 1
Source this file into your shell after changing into the Hem working
to get the hem commands on your path:

    $ cd $(dirname $0)
    $ . work-sh
    $ cd ~
    $ type hem
    hem is $(dirname $0)/hem

(You will need to source the work-sh script for each shell environment.)
EOF

if test ! -f $(dirname $0)/hem.sh
then
    echo "This doesn't look like a Hem working directory..."
else
	HEM_EXEC="$(pwd)"
    test -z "$(echo $PATH | grep -F "$HEM_EXEC")" && {
        PATH="$(pwd):$PATH"
        export PATH
        echo "Hem should now be active for the current shell environment."
    } ||
    echo "$(pwd) already on PATH"
fi
