Add more functionality to mls

This commit is contained in:
Maxwell 2024-07-04 17:20:49 +10:00
parent 9136168689
commit 926e65427c

16
main.py Normal file → Executable file
View File

@ -55,7 +55,17 @@ try:
matFile = open(argList[1])
print(matFile.read())
elif argList[0] == "mls":
os.listdir(currentDirectory)
try:
if argList[1] == "":
print(os.listdir(currentDirectory))
else:
argList[1] = mlsDirectory
if mlsDirectory[0] == "/":
print(os.listdir(mlsDirectory))
else:
print(os.listdir(currentDirectory + "/" + mlsDirectory))
except Exception:
print(os.listdir(currentDirectory))
elif argList[0] == "cd":
try:
directoryForCD = argList[1]
@ -72,7 +82,7 @@ try:
subprocess.run(argList)
except Exception:
print("Command", command, "either doesn't exist, isn't in the path or isn't in this directory.")
except Exception:
print("Looks like there was an error. Exiting...")
#except Exception:
# print("Looks like there was an error. Exiting...")
except KeyboardInterrupt:
print(" detected! Exiting...")