#!/usr/bin/python3

#########################################################################
# pglauncher - An unoffical Launcher for the "Project: Gorgon" game     #
# Copyright (C) 2014  Alexander Schlarb                                 #
#                                                                       #
# This program is free software: you can redistribute it and/or modify  #
# it under the terms of the GNU General Public License as published by  #
# the Free Software Foundation, either version 3 of the License, or     #
# (at your option) any later version.                                   #
#                                                                       #
# This program is distributed in the hope that it will be useful,       #
# but WITHOUT ANY WARRANTY; without even the implied warranty of        #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
# GNU General Public License for more details.                          #
#########################################################################


import argparse
import importlib
import sys

def main(argv=sys.argv[1:]):
	parser = argparse.ArgumentParser()
	parser.add_argument("--ui", "-u", dest="ui", action="store", default="cli",
			help="The user interface to use (cli)")
	args, args_unknown = parser.parse_known_args()
	
	# Load requested user interface
	try:
		ui = importlib.import_module("pglauncher.ui.%s.main" % (args.ui)).UI()
	except ImportError as e:
		parser.error("User interface \"%s\" not available" % (args.ui))
	
	# Show user interface
	ui.run(args_unknown)


if __name__ == '__main__':
	main(sys.argv[1:])
