#!/usr/bin/env bash
# THERAPIST %hash%

exitcode=0

# Get the current working directory
pushd "$(dirname "$0")" > /dev/null
CWD=$(pwd)
popd > /dev/null

# Run the legacy pre-commit if it exists
if [ -x "$CWD"/pre-commit.legacy ]; then
    "$CWD"/pre-commit.legacy
    if [ $? -ne 0 ]; then
        exitcode=1
    fi
fi

%therapist_bin% run
if [ $? -ne 0 ]; then
    exitcode=1
fi

exit ${exitcode}
