Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWriter2 committed Nov 20, 2020
1 parent c55cdfc commit d9a22c6
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions Main.py
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()

0 comments on commit d9a22c6

Please sign in to comment.