-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (31 loc) · 814 Bytes
/
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
import sys
import os
import handler as core
import common
import config
#This will prevent keyboard interrupt tracebacks.
def suppress_keyboard_interrupt() -> None:
previous_hook=sys.excepthook
def dummy_hook(type,value,tbk):
if type!=KeyboardInterrupt:
sys.excepthook=previous_hook
else:
pass
sys.excepthook=dummy_hook
if __name__!="__main__":
print("This module must not be imported. Exiting.")
sys.exit(1)
suppress_keyboard_interrupt()
check=0;
for x in sys.argv:
for y in common.commands:
if x==y:
check+=1
if check>1:
print("More than one command is not allowed at a time.")
sys.exit(1)
if check==0:
print(common.help_msg)
sys.exit(0)
os.chdir(config.WD_D)
core.handle(sys.argv[0:])