Implemented the '--ai-settings' flag

This commit is contained in:
Eesa Hamza
2023-04-13 14:02:42 +03:00
parent 428caa9bef
commit 0f6fba7d65
3 changed files with 30 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
import yaml
from colorama import Fore
def clean_input(prompt: str=''):
try:
return input(prompt)
@@ -6,3 +9,14 @@ def clean_input(prompt: str=''):
print("Quitting...")
exit(0)
def validate_yaml_file(file: str):
try:
with open(file) as file:
yaml.load(file, Loader=yaml.FullLoader)
except FileNotFoundError:
return (False, f"The file {Fore.CYAN}`{file}`{Fore.RESET} wasn't found")
except yaml.YAMLError as e:
return (False, f"There was an issue while trying to read with your AI Settings file: {e}")
return (True, f"Successfully validated {Fore.CYAN}`{file}`{Fore.RESET}!")