-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfoxtail.py
49 lines (49 loc) · 1.5 KB
/
foxtail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from termcolor import colored as c
from termcolor import cprint
import os
running = True
def NU():
print("unknown command")
while running:
path_ = os.getcwd()
path = format(path_)
inp = input(c(path, 'blue') + c(" $", 'green'))
if inp.startswith("cd "):
try:
change = inp.replace("cd ", "")
os.chdir(path + "/" + change)
except:
print("File is either not a directory or does not exist.")
elif inp == "l":
os.system("ls")
elif inp == "cwd":
print(c(path, 'green'))
elif inp.startswith("echo "):
out = inp.replace("echo ", "")
print(out)
elif inp.startswith("mdir "):
mk = inp.replace("mdir ", "")
if not os.system("mkdir " + mk) == 0:
print("bash error")
elif inp.startswith("rem "):
rm = inp.replace("rem ", "")
if not os.system("rm " + rm) == 0:
print("bash error")
elif inp.startswith("remdir "):
rm = inp.replace("remdir ", "")
if not os.system("rm -r " + rm) == 0:
print("bash error")
elif inp.startswith("mf "):
add = inp.replace("mf ", "")
if not os.system("touch " + add) == 0:
print("bash error")
elif inp.startswith("read "):
read = inp.replace("read ", "")
if not os.system("cat " + read) == 0:
print("bash error")
elif inp.startswith("version"):
cprint("1.0", 'green')
elif inp == "exit":
running = False
else:
NU()