Add better config file support

This commit is contained in:
Maxwell 2024-07-15 14:05:01 +10:00
parent c58c776c48
commit ac03e87e02

10
main.py
View File

@ -20,10 +20,11 @@ argList = ["", ""]
# Start work on checking whether a config file exists
if os.path.isfile(expanduser("~") + "/.config/mash/mash.conf") == False:
print("Config file does not exist. Make a file at .config/mash/mash.conf to configure things")
configFilePath = "/etc/mash/mash.conf"
else:
configFilePath = (expanduser("~") + "/.config/mash/mash.conf")
# Parse config file, adding variables
configFileFile = open((expanduser("~") + "/.config/mash/mash.conf"))
configFileFile = open(configFilePath)
configFile = configFileFile.read()
confArgNumber = 0
@ -80,7 +81,8 @@ def mainLoop(startDir):
# Set directory and prompt for input.
os.chdir(currentDirectory)
command = input(Fore.GREEN + user + Fore.WHITE + "@" + socket.gethostname() + Fore.BLUE + " " + currentDirectory + Fore.WHITE + " > ")
if command == "" :
mainLoop(currentDirectory)
# Clean some things up for the argument parser.
argNumber = 0
argList.clear()