#!/bin/bash
#                       /usr/local/bin/faery
# https://crystalfaeries.net/posix/bin/faery
# celeste@crystalfaeries.net FAERY 2021-05-01 19:24:18+00:00
# 00	16	 *	 *	3	/usr/local/bin/faery	faery_magick	300
# 00	16	 *	 *	5	/usr/local/bin/faery	faery_goddesses	300
# -k or --kill should terminate any alerts we've initiated
let help=07
case $# in
0 )	# ummm... we rather expected an argument or two
	exec $0 --help
	exit	$?	# exec not supposed to return
	;;
* )	while [[ $# -gt 0 ]]
	do
		case "${1}" in
		-v | --version )
			head -n 4 $0 | tail -n 1
			;;
		-h | --help )
			head -n $help $0
			;;
		-k | --kill )
			pkill $0	# suicide all copies of me running
			;;
		* )	#	no, we have NOT sanitized these inputs:
			alert	"${1} START"	&
			sleep	"${2}"m	# time in minutes
			alert	"${1} STOP"
			;;
		esac
		shift	# out with the old, in with the new argument
	done
	;;
esac
exit	$?
