#!/bin/sh -e

usage() {
  printf %s "\
$(basename "$0")

commands:
  [text]
  [notificationTitle] [text]
  [notificationTitle] [subTitle] [text]
  [notificationTitle] [subTitle] [soundName] [text]
"
  exit 1
}

case "$#" in
  1)
    message_command="display notification \"$1\""
    exec osascript -e "${message_command}"
    ;;
  2)
    message_command="display notification \"$2\" with title  \"$1\""
    exec osascript -e "${message_command}"
    ;;
  3)
    message_command="display notification \"$3\" with title  \"$1\" subtitle  \"$2\""
    echo "message_command: ${message_command}"
    exec osascript -e "${message_command}"
    ;;
  4)
    message_command="display notification \"$4\" with title  \"$1\" subtitle  \"$2\" sound name  \"$3\""
    echo "message_command: ${message_command}"
    exec osascript -e "${message_command}"
    ;;
  *)
    usage
    ;;
esac
