#!/bin/sh
# icafe cli

if test ! -f "$1" ; then
  echo "file does not exist: $1"
  exit 1
fi

hook="$(dirname "$0")/prepare-commit-msg.old"

if [ -f $hook ]; then
  sh $hook "$@"
fi

if command -v icafe &> /dev/null; then
  icafe pre-commit $1 < /dev/tty
elif command -v $HOME/.icafe/bin/icafe &> /dev/null; then
  $HOME/.icafe/bin/icafe pre-commit $1 < /dev/tty
fi

exit 0
