#!/bin/sh

# This is a command wrapper for WRT, a WRiting Tool

print_help() {
  echo "wrt - a writing tool"
  echo
  echo "Usage: $0 [command] [args]"
  echo "    wrt display     Print HTML for entries"
  echo "    wrt render-all  Render all defined entries to filesystem"
  echo "    wrt addprop     Add a property to an entry"
  echo "    wrt findprop    Find entries containing certain properties"
  echo "    wrt -h          Print this help message"
  echo
  echo "You must specify a command."
  exit 1
}

if [ $# -lt 1 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
  print_help
fi

SUBPROG="wrt-$1"
shift
exec $SUBPROG "$@"
