#!/bin/sh
path="${0%/*}"
script="${0##*/}"
nodash="${script//-/ }"

cmd=
case "$#" in
0)	;;
*)	cmd="$1"
	shift
	case "${cmd}" in
		dali[01])
			export DALI_ID="${cmd:4:1}"
			cmd="${cmd::4}"
		;;
	esac
	test -x "$0-$cmd" && exec "$0-$cmd" "$@"
	#test -x "$0-other" && exec "$0-other" "$@"
;;
esac

echo "Usage: ${nodash} COMMAND [OPTIONS] [TARGET]"
if [ -n "$cmd" ]; then
	echo "${script} command '$cmd' not found."
fi
printf "${script} commands are:\n"
printf "    "
find "${path}" -type f -executable -name "${script}-*" | sort | awk -F"${script}-" '{printf("%s ", $2)}'
printf "\n"

exit 1
