main() {
  ret=0
  cmd=""

  if [ -z "$1" ]; then
    printf "No command specified\n\n"
    usage
    exit 1
  fi

  case "$1" in
    "new" | "n")
      cmd="new_note"
      ;;
    "ls")
      cmd="ls_notes"
      ;;
    "search" | "s")
      cmd="search_filenames_and_contents"
      ;;
    "find" | "f")
      cmd="find_notes"
      ;;
    "grep" | "g")
      cmd="grep_notes"
      ;;
    "open" | "o")
      cmd="open_something"
      ;;
    "rm")
      cmd="remove_note"
      ;;
    --help | -help | -h)
      cmd="usage"
      ;;
    *)
      printf '%s' "$1 is not a recognized notes command.\n\n"
      cmd="usage"
      ret=1
      ;;
  esac
  shift

  ${cmd} "$@"
  ret=$((ret + $?))
  exit "${ret}"
}
main "$@"
