2024-07-03 12:08:56 +10:00
|
|
|
import os
|
|
|
|
import subprocess
|
2024-07-03 12:38:20 +10:00
|
|
|
import re
|
2024-07-03 12:08:56 +10:00
|
|
|
|
|
|
|
initDirectory = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
currentDirectory = initDirectory
|
|
|
|
version = "0.0.1"
|
|
|
|
|
2024-07-03 12:38:20 +10:00
|
|
|
def grabArgument(fullCommand, commandRan):
|
|
|
|
fullCommand.replace(commandRan, "")
|
|
|
|
|
2024-07-03 12:08:56 +10:00
|
|
|
while True:
|
|
|
|
command = input(currentDirectory + " > ")
|
|
|
|
if command == "pwd":
|
|
|
|
print(currentDirectory)
|
2024-07-03 12:38:20 +10:00
|
|
|
elif command == ("cat"):
|
|
|
|
try:
|
|
|
|
|
|
|
|
catFile = input("File to catalog: ")
|
|
|
|
catFileOpened = open(catFile)
|
|
|
|
print(catFileOpened.read())
|
|
|
|
except Exception:
|
|
|
|
print("File", catFile, "either doesn't exist or isn't in this directory.")
|
2024-07-03 12:08:56 +10:00
|
|
|
elif command == "version":
|
|
|
|
print(version)
|
|
|
|
else:
|
2024-07-03 12:12:07 +10:00
|
|
|
subprocess.run(command)
|