-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPS2CLI.py
executable file
·40 lines (30 loc) · 1.01 KB
/
PS2CLI.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
#!/usr/bin/env python
# This is the main file for the PowerSynth 2 backend with the command line interface (CLI)
import sys, os
from core.CmdRun.CmdHandler import CmdHandler
from core.PSCore import PSCore
import traceback
class PS2CLI(PSCore):
def excute(self):
print("INFO: Running Macro File "+self.MacroScript)
self.cmd = CmdHandler(self)
self.cmd.load_macro_file(self.MacroScript)
def run(self):
os.chdir(self.PSWork)
try:
if self.interactive:
self.create()
else:
self.excute()
ExitCode=0
except:
traceback.print_exc()
print("ERROR: PowerSynth failed to run :(")
ExitCode=1
os.chdir(self.cwd)
return ExitCode
if __name__ == "__main__":
if len(sys.argv)<2 :
sys.exit(f"Usage: {sys.argv[0]} Macrofile(if not exist, run interactive flow) [TempDir]")
cli=PS2CLI(sys.argv[1],sys.argv[2] if len(sys.argv)>2 else "")
cli.run()