-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c55cdfc
commit d9a22c6
Showing
1 changed file
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import sys | ||
import random | ||
import os | ||
import platform | ||
|
||
class Program: | ||
def __init__(self): | ||
self.coms = { | ||
"listdir":"self.search", | ||
"listfile":"self.search_file", | ||
"main.exit":"self.exit", | ||
"text.write":"self.write", | ||
"dirgo":"self.godir", | ||
"main.about":"self.about", | ||
"main.win.about":"self.aboutwin", | ||
"createdir":"self.dirmake" | ||
} | ||
|
||
def command(self): | ||
self.inp = input("Type the command:") | ||
if self.inp in self.coms: | ||
eval(self.coms[self.inp] + "()") | ||
self.command() | ||
else: | ||
input("Wrong or unknown command, enter to continue") | ||
self.command() | ||
|
||
def search(self): | ||
self.finp = input("Type dir to search:") | ||
if self.finp == "self": | ||
with os.scandir(os.path.abspath(os.getcwd())) as self.lt: | ||
for i in self.lt: | ||
if os.path.isdir(i): | ||
print(i) | ||
else: | ||
return | ||
else: | ||
with os.scandir(self.finp + "/") as self.ents: | ||
for ent in self.ents: | ||
if os.path.isdir(ent): | ||
print(ent) | ||
else: | ||
return | ||
|
||
def search_file(self): | ||
with os.scandir(input("Type dir to search:") + "/") as self.ents: | ||
for ent in self.ents: | ||
if os.path.isfile(ent): | ||
print(ent.name) | ||
else: | ||
return | ||
|
||
def exit(self): | ||
input("Thanks for using(Enter to continue)") | ||
sys.exit() | ||
|
||
def write(self): | ||
self.f = open(input("Type the name of the file:") + ".txt", "w+") | ||
for i in range(1000): | ||
self.l = input("(:") + "\n" | ||
if self.l == "///stop\n": | ||
return | ||
else: | ||
self.f.write(self.l) | ||
|
||
def godir(self): | ||
os.chdir(input("Type the directory to which you want to go:")) | ||
return | ||
|
||
def about(self): | ||
print("GoldenPie Console") | ||
print("Version 1.0 - Build 1/20.11.19") | ||
input("Enter to continue") | ||
return | ||
|
||
def aboutwin(self): | ||
if platform.system() == "Windows": | ||
os.startfile("C:\Program Files (x86)\GoldenPie\gpabtwin.vbs") | ||
input("Enter to continue") | ||
return | ||
else: | ||
return | ||
|
||
def dirmake(self): | ||
os.mkdir(input("Type the name of the folder:") + "/") | ||
return | ||
|
||
a = Program() | ||
a.command() |