-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
85 lines (58 loc) · 1.75 KB
/
Main.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import os
import time
import getpass as gt
import socket
import sys
from pylon import *
motd = open("core/lib/motd.txt").read()
help = open("core/lib/help.txt").read()
user = os.getlogin()
host = socket.gethostname()
path = os.getcwd()
path_preview = path
home = path
os.chdir(home)
path = os.getcwd()
home = path
path_preview = path
if path == home:
path_preview = "~"
cursor = ">"
inputline = "\n" + col["cyan"] + user + "@" + host + col["white"] + " - " + col["mag"] + "[" + path_preview + "]" + col["white"] + "\n" + cursor + " "
def start():
home = path
os.chdir(home)
def update():
inputline = "\n" + col["cyan"] + user + "@" + host + col["white"] + " - " + col["mag"] + "[" + path_preview + "]" + col["white"] + "\n" + cursor + " "
path = os.getcwd().replace("\\", "/")
path_preview = path
if path == home:
path_preview = "~"
start()
print(motd)
while True:
update()
cmd = input(inputline)
cmdsplit = cmd.split()
if cmd == "" or cmd.startswith(" "):
continue
elif cmd.startswith("help"):
print(help)
elif cmd.startswith("clear") or cmd.startswith("cls"):
os.system("cls")
elif cmd.startswith("exit"):
sys.exit()
elif cmd.startswith("cd"):
cd(getargs(cmd))
elif cmd.startswith("run") and cmd.endswith(""):
exec(getargs(cmd))
elif cmd.startswith("print"):
print(getargs(cmd))
elif cmd.startswith("path"):
print(path)
elif cmd.startswith("flask"):
startFlask()
elif cmd.startswith("setcursor"):
cursor = getargs(cmd)
else:
error("Command not found or invalid syntax", cmd)