-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrr_script_master.py
65 lines (60 loc) · 2.5 KB
/
rr_script_master.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
#!/usr/bin/env python
import sys
import os
argz = sys.argv
class co:
HEADER = '\033[95m'
OKBL = '\033[94m'
OKCY = '\033[96m'
OKGR = '\033[92m'
WARN = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def doThing(command, *args, **kwargs):
argList = []
for arg in command:
argList.append(arg)
# print(argList)
# binLoc= argList[0]
if(args!=None):
command = argList[1]
if(command=='-v' or command=='-version' or command == '--v' or command=='--version'):
print("=======================================================")
print('\n too early for that; .000001 maybe \n')
print("=======================================================")
return
if(command=='-h' or command=='-help'):
print("=======================================================")
print("\n -v or -version || to see the version number")
print("\n -h or -help || to see this help text")
print("\n -r or -run or run || to run a route directly from Rad Routes ")
print(" route should follow -r. Command will look like example below;")
print(" rr -r my-rad-route \n")
print("=======================================================")
return
try:
if(command=='-r'or command=='run' or command == '-run' or command == 'r'):
if (len(argList)>=3):
route = argList[2]
else:
print(f'{co.WARN}\n No Route Given, Please declare a route. to be ran after the -r \n \n see rr -h for help')
return
# print(mod)
os.system(f'cd ./runners && py MasterRunner.py {route}')
return
except:
print(f'{co.FAIL} Improper route or run command, please see $:"rr -h" for help.')
raise
if(command=='-u'or command=='upload' or command == '-upload' or command == 'up' or command == '-up' or command == 'uplad'):
route = argList[2]
return
else:
print(f"{co.WARN}\n \n Was not a known Rad Routes command;\n \n Run $: rr -h for help with commands")
try:
doThing(argz)
except:
# print( str(argz[2]) + " Was not a proper Rad Route command;\n \nCheck rr -h for help with commands")
print(f"{co.FAIL} Was not a proper Rad Route command;\n \nCheck rr -h for help with commands")
raise