#!/bin/bash -e

source /usr/share/common-install-function-ddebs/common-install-function

domain=lahdekoodius-by-mikkosoftproductions

APP_FULLNAME="Lähdekoodius"
APP_COPYRIGHT="Mikkosoft Productions"
APP_DESC="Demo by Mikkosoft Productions, released in 2019"

APP_EXE="lähdekoodius"

function usage()
{
	NSH_std_usage
	echo "    -f				run in fullscreen"
	echo "    -w				run in a window"
}

function run()
{
	backuppwd=$(pwd)
	cd "/usr/lib/x86_64-linux-gnu/${domain}" || exit
	"./${APP_EXE}" "$@"
	cd "$backuppwd" || exit
}


if [ "$#" -gt "1" ]; then
	usage
	exit 1
elif [ "$#" -lt "1" ]; then
	run
else
	case "$1" in
	--help)
		usage
		;;
	-f|-w)
		run "$1"
		;;
	*)
		usage
		exit 1
		;;
	esac
fi

exit 0
