#!/bin/bash
set -e

usage() {
  echo ""
  echo "tsm usage:"
  echo "=========="
  echo ""
  echo "  tsm <command>"
  echo ""
  echo "Where command can be one of the following list:"
  echo ""
  echo "  test|lint|build|format|init|publish|start|clean"
  echo ""
}


# Need bash >= 3 for guarding below
if ((BASH_VERSINFO[0] < 3)); then echo "Sorry, you need at least bash-3.0 to run this script." >&2; exit 1; fi

# Guard against invalid commands
if [[ "$1" =~ ^(test|lint|build|format|init|publish|start|clean)$ ]]; then
  # Pass command stuff to other scripts
  ./node_modules/tsmill/$@
else
  usage
fi
