-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
40 lines (33 loc) · 1.05 KB
/
Copy pathmain.py
File metadata and controls
40 lines (33 loc) · 1.05 KB
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
import argparse
from scripts.scrap import scrap
from scripts.post_score import post_score
from scripts.comment_score import comment_score
from scripts.build_graph import build_graph
from scripts.display_graph import display_graph
from scripts.investigate_user import investigate_user
# Mapping from CLI argument to actual function
FUNCTION_MAP = {
"scrap": scrap,
"post-score": post_score,
"comment-score": comment_score,
"build-graph": build_graph,
"display-graph": display_graph,
"investigate-user": investigate_user,
}
def main():
parser = argparse.ArgumentParser(
description="Run a specific function from the scripts."
)
parser.add_argument(
"script", help="The script name to run (scrap, post-score, comment-score)"
)
args = parser.parse_args()
func = FUNCTION_MAP.get(args.script)
if func is None:
print(
f"Error: Unknown script '{args.script}'. Available options: {', '.join(FUNCTION_MAP.keys())}"
)
exit(1)
func()
if __name__ == "__main__":
main()