From 926e65427c54444dfbd616b71ac1474a008dac05 Mon Sep 17 00:00:00 2001 From: max Date: Thu, 4 Jul 2024 17:20:49 +1000 Subject: [PATCH] Add more functionality to mls --- main.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) mode change 100644 => 100755 main.py diff --git a/main.py b/main.py old mode 100644 new mode 100755 index f55cee4..0611012 --- a/main.py +++ b/main.py @@ -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...")