28 lines
534 B
Python
Executable file
28 lines
534 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import getopt
|
|
import sys
|
|
import importlib
|
|
|
|
|
|
def main(argv):
|
|
game = ''
|
|
usage = 'play.py -g <gamename>'
|
|
|
|
try:
|
|
opts, args = getopt.getopt(argv, "hg:", ["game="])
|
|
except getopt.GetoptError:
|
|
print(usage)
|
|
sys.exit(2)
|
|
for opt, arg in opts:
|
|
if opt == '-h':
|
|
print(usage)
|
|
sys.exit()
|
|
elif opt in ("-g", "--game"):
|
|
game = arg
|
|
importlib.import_module(f'{game}.game')
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main(sys.argv[1:])
|