forked from VPanjeta/ModiScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMODI
More file actions
executable file
·34 lines (25 loc) · 671 Bytes
/
MODI
File metadata and controls
executable file
·34 lines (25 loc) · 671 Bytes
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
#!/usr/bin/env python3
import os
import sys
from modiscript.api import ModiScript
from modiscript.utils import ErrorHandler, FNF, usage
DEBUG = False
def main():
if len(sys.argv) < 2 or '-h' in sys.argv or '--help' in sys.argv:
usage()
filename = sys.argv[-1]
# filename = "modi.chai"
if '-d' in sys.argv or '--debug' in sys.argv:
global DEBUG
DEBUG = True
# check existence
if not os.path.isfile(filename):
raise ErrorHandler(FNF, filename)
# execute
ms = ModiScript(DEBUG)
ms.execute(filename)
if __name__ == '__main__':
try:
main()
except ErrorHandler as e:
print(e)