This repository has been archived on 2022-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
texty/__main__.py

25 lines
708 B
Python
Raw Normal View History

2022-03-22 11:22:50 +01:00
from genericpath import isdir
2022-01-25 17:16:07 +01:00
from lib.game import *
2022-03-22 11:22:50 +01:00
from colorama import init, Back, Fore
from os import mkdir, listdir
2021-11-02 17:40:54 +01:00
2022-01-26 09:23:30 +01:00
def main(): # TODO: Maybe a menu for available text games?
init()
2022-03-22 11:22:50 +01:00
if(not isdir("./games")):
mkdir("./games")
games = []
for file in listdir("./games"):
if file.endswith("yml") or file.endswith("yaml"):
# finds available games
try:
# try parsing
g = load(f"./games/{file}")
games.append(g)
except Exception as e:
print(f"{Back.RED}{Fore.RED}An exception has occured while loading {file}:")
print(e)
2021-11-02 17:40:54 +01:00
if __name__ == "__main__":
2022-03-22 11:22:50 +01:00
main()