#!/bin/sh

git status -sb # print nothing to do msg
if [ "$#" -eq 0 ]; then
  if git diff --staged --stat --exit-code >/dev/null; then
    if git diff --stat --exit-code >/dev/null; then
      echo "Nothing to commit, working tree clean"
    else
      printf '%b\n' "Nothing staged, so running \e[1;36mgit commit -a\e[m."
      printf '%b\n' "\e[0;35m----------------------------------------------------------\e[m"
      git commit -a
    fi
  else
    printf '%b\n' "\e[0;35m----------------------------------------------------------\e[m"
    git commit
  fi
else
  printf '%b\n' "\e[0;35m----------------------------------------------------------\e[m"
  git commit "$@"
fi
