-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
227 lines (196 loc) · 9.26 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
import time
import sys
import os
import webbrowser
import random
pathtofile = "temp folder"
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
setuptemp = "_files/setup.json"
pathtown = "Whatsnew.txt"
pathtown1 = os.path.join(base_path, pathtown)
pathtosetup = os.path.join(base_path, setuptemp)
pathtonontemp = "C:/Users/Public/PyPrompt/setup.json"
def delay_print(s):
for c in s:
sys.stdout.write(c)
sys.stdout.flush()
time.sleep(0.20)
os.system("cls")
delay_print("PyPrompt")
print("")
print("Version 1.4 PBR")
print()
print("Type help to get a list for commands.")
while True:
command = input("#/> ")
if command == "help":
print("------------PyPrompt------------")
print("help // Shows this list of commands.")
print("dir // Shows the directory.")
print("clear // Will cls the screen")
print("exit // This will quit the Script")
print("cd // Will bring you to an other directory")
print("run (T)// Will allow you to run files")
print("show (T)// Will show you the text from a text file")
print("wn // Will show a list of What's new")
print("settings // Will open the settings")
print("------------PyPrompt------------")
elif command == "cd":
cd = input("cd_dir/>")
os.chdir(cd)
elif command == "clear":
os.system("cls")
elif command == "exit":
break
elif command == "dir":
os.system("dir")
elif command == "run":
os.system("cls")
print("Welcome to run! use 'help' to see all active commands ")
print("If you wanna run python code put python before the name of file")
print("else it will open in text editor")
while True:
run = input("run/>")
if run == "help":
print("------------PyPrompt/run------------")
print("dir // Will show all files expect .uselessfileextensionthatwillprobablyneverbeusedbecauseimwrittingthisat1130pmandisalsomadebymbd1343 sorry!")
print("cd // Allows you to go to different folders")
print("exit // Will bring you back to the main terminal")
print("cexit // Will clear the console and also exit back to the main terminal")
print("------------PyPrompt/run------------")
elif run == "dir":
os.system("dir /B/A-D | findstr /EILV '.uselessfileextensionthatwillprobablyneverbeusedbecauseimwrittingthisat1130pmandisalsomadebymbd1343'")
elif run == "cd":
os.system("dir /a:d ")
print("Please enter which folder you want")
foldercd = input("run_folder/>")
if foldercd == "":
print("Prompt is empty!")
elif foldercd == "..":
print("This currently doesn't work :( I blame os.chdir!")
elif foldercd == ".":
print("This currently doesn't work :( I blame os.chdir!")
else:
os.chdir(foldercd)
elif run == "exit":
break
elif run == "cexit":
os.system("cls")
break
else:
os.system(run)
elif command == "show":
os.system("cls")
print("Welcome to show! use 'help' to see all active commands ")
while True:
show = input("show/>")
if show == "help":
print("------------PyPrompt/show------------")
print("this is kinda the same as run but here you read the contents of the file and not run it")
print("------------PyPrompt/show------------")
print("dir // Will show all files expect .uselessfileextensionthatwillprobablyneverbeusedbecauseimwrittingthisat1130pmandisalsomadebymbd1343 sorry!")
print("cd // Allows you to go to different folders")
print("exit // Will bring you back to the main terminal")
print("cexit // Will clear the console and also exit back to the main terminal")
print("------------PyPrompt/show------------")
elif show == "dir":
os.system("dir /B/A-D | findstr /EILV '.uselessfileextensionthatwillprobablyneverbeusedbecauseimwrittingthisat1130pmandisalsomadebymbd1343'")
elif show == "cd":
os.system("dir /a:d ")
print("Please enter which folder you want")
foldercd = input("show_folder\>")
if foldercd == "":
print("Prompt is empty!")
else:
os.chdir(foldercd)
elif show == "..":
print("This currently doesn't work :( I blame os.chdir!")
elif show == ".":
print("This currently doesn't work :( I blame os.chdir!")
elif show == "exit":
break
elif show == "cexit":
os.system("cls")
break
elif show == "":
print("Prompt is empty! Maybe type something?")
else:
os.system('%s %s' % ("more", show))
elif command == "wn":
os.system('%s %s' % ("more", pathtown1))
elif command == "settings":
os.system("cls")
print("------------\033[0;30;47mPyPrompt/Settings\033[0m------------")
print("Welcome to the settings menu! What can we do for you?")
while True:
print("[1] = General")
print("[2] = Credits & Info")
print("[3] = Exit")
settingsmenu = input("#/Settings/>")
if settingsmenu == "1":
os.system("cls")
print("------------\033[0;30;47mPyPrompt/Settings/General\033[0m------------")
print("Settings/General Basic settings for PyPrompt")
while True:
print("[1] = Delete setup file")
print("[2] = Go back")
genesettings = input("#/S/General>")
if genesettings == "1":
if os.path.exists(pathtonontemp):
pathtofile = "C:/Users/Public/PyPrompt/setup.json"
os.system("cls")
print("------------\033[0;30;47mConfirm\033[0m------------")
print("Are you sure you want to erase the setup file?")
print("By doing this you will have to do the setup again when you open this program\n")
print("Path to file:", pathtofile)
print("[y/n]")
while True:
eraseconfirm = input("Confirm> ")
if eraseconfirm == "y":
os.remove(pathtofile)
if os.path.exists(pathtofile):
print("The file is not deleted! Something happend")
input("------------\033[0;30;47mContinue\033[0m------------")
else:
print("The file is successfully deleted!")
input("------------\033[0;30;47mContinue\033[0m------------")
break
elif eraseconfirm == "n":
break
elif genesettings == "2":
break
elif settingsmenu == "2":
os.system("cls")
print("------------\033[0;30;47mCredits & Info\033[0m------------")
print("Version: 1.4 Public Beta Release | Change log >> [1]\n")
print("Created by Maxboiy/MBD\n")
print("Credits to:")
print("the internet | Without it you would not have this program right now\n")
print("Compiler:\n PyInstaller\n")
print("Compile date:\n 5-August-2024\n")
print("Open Github page \n [2]\n")
print("[3] = Go back")
while True:
candi = input("#/S/Info> ")
if candi == "1":
os.system('%s %s' % ("more", pathtown1))
print("[3] = Go back")
elif candi == "2":
webbrowser.open("https://github.com/Maxboiy/PyPrompt")
elif candi == "3":
break
elif candi == "4":
webbrowser.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
print("Got you ;)")
elif settingsmenu == "3":
os.system("cls")
print("------------\033[0;30;47mClose\033[0m------------")
print("[1] = Go back to the program")
print("[2] = Close the program")
closeandquit = input("#/S/Quit> ")
if closeandquit == "1":
break
elif closeandquit == "2":
Programclosed
else:
print(command, "Invalid command! Maybe check for typos?")