-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
79 lines (75 loc) · 2.16 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
import sys, os, time, webbrowser, urllib.request, zipfile, io, subprocess
from shutil import copyfile
import shutil
from zipfile import ZipFile
from files import *
from com import *
from excom import *
start_path = os.getcwd()
def Run():
def fallback():
print('command doesnt exist')
def checkDirectory():
cd = input('cd~dir.check$ ')
if os.path.exists(cd):
print(os.path.exists(cd))
else:
print('that directory does not exist')
def workingDirectory():
path = input('wd.path$ ')
os.chdir(path)
print(os.getcwd())
def non_ess():
def time():
import datetime
now = datetime.datetime.now()
print('Currnet date and time: ')
print(now.strftime("%Y-%m-%d %H:%M:%S"))
def ver():
print('version 0.04.5')
Action2Dictionary = {
'ver': ver,
'time': time
}
action = input('non_ess action: ')
Non_essAction = Action2Dictionary.get(action, fallback)
Non_essAction()
def ess():
def ls():
print(os.listdir(os.getcwd()))
def home():
os.chdir(start_path)
EssDictionary = {
'ls': ls,
'cd!':home
}
ess_action = input('ess action: ')
Ess_action= EssDictionary.get(ess_action, fallback)
Ess_action()
def checkDir():
print(os.getcwd())
def clear():
os.system('cls' if os.name=='nt' else 'clear')
actionDictionary = {
'cd.dwn': download,
'cd.rd': read,
'cd.wr': write,
'cd.ex': extra,
'cd.ex.com':run_ex,
'cd.com': command,
'cd~dir': checkDirectory,
'cd~': checkDir,
'wd': workingDirectory,
'cd.ex.opt': ext_com,
'clear': clear,
'non_ess': non_ess,
'ess': ess
}
while True:
start = input('>')
if start == 'quit' or start == 'exit':
break
actionToRun = actionDictionary.get(start, fallback)
actionToRun()
return
Run()