-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
44 lines (40 loc) · 1.37 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
import argparse
import sys
import os
# Add the my_project directory to sys.path
project_dir = os.path.abspath(os.path.dirname(__file__))
if project_dir not in sys.path:
sys.path.append(project_dir)
# Import scripts based on command-line arguments
def run_script(script_name):
if script_name == 'test':
from source import test
test.run()
elif script_name == 'load_parser':
from parsers import load
load.run()
elif script_name == 'test_parser':
from parsers import test
test.run()
elif script_name == 'test_json_parser':
from parsers import test
test.test_json()
elif script_name == 'print_request_prompt':
from scripts import print_request_prompt
print_request_prompt.run()
elif script_name == 'load_prompt':
from prompts import load
load.run()
elif script_name == 'write_html':
from results import write_html_results
write_html_results.run()
print("Completed")
else:
print(f"Unknown script: {script_name}")
sys.exit(1)
# Parse command-line arguments
parser = argparse.ArgumentParser(description="Run a script from the my_project/scripts directory.")
parser.add_argument("script_name", help="Name of the script to run (e.g., 'script1', 'script2')")
args = parser.parse_args()
# Run the specified script
run_script(args.script_name)