Make MOTD configurable

This commit is contained in:
Maxwell 2024-07-11 16:55:08 +10:00
parent bc756ec244
commit 42bf0e129a

13
main.py
View File

@ -33,7 +33,8 @@ confArgList = ["", ""]
for line in configFile:
for letter in line:
if letter == ' ':
if letter == ':':
confArgList[confArgNumber] = confArgList[confArgNumber] + ":"
confArgNumber = confArgNumber + 1
elif letter == ',':
confArgList.append(",")
@ -43,12 +44,12 @@ for line in configFile:
confArgList[confArgNumber] = confArgList[confArgNumber] + letter
except Exception:
confArgList.append(letter)
print(confArgList)
for word in confArgList:
if "\n" in word:
confArgList[confArgList.index(word)] = word.replace("\n", "")
print(confArgList)
for word in confArgList:
if word == "motd:":
motd = confArgList[confArgList.index(word) + 1]
# Write the time to the history file
historyFile = open((expanduser("~") + "/.history.mash"), "a")
@ -56,8 +57,8 @@ historyFile.write("\n")
historyFile.write(("Session on " + str(datetime.now())))
historyFile.write("\n")
# Welcome message. Probably going to be configurable soon enough.
print("Welcome to Mash, " + user + "@" + socket.gethostname() + "! Mash is currently on version " + version)
# Welcome message. Configurable with "motd: (your motd here),"
print(motd)
# Main loop.
try: