-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (28 loc) · 983 Bytes
/
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
from parser import Parser
import analyzer
def stripartifacts(docs: str) -> str:
project_overview_index = docs.find("# Project Overview")
if project_overview_index != -1:
docs = docs[project_overview_index:]
docs = docs[:-3] if docs.endswith('```') else docs
return docs
def main() -> None:
"""
Main entry point
"""
print("Documentation generator")
parser = Parser("analyzer.py")
compressed_ast, profiler = parser.parse()
documentation = analyzer.analyze(compressed_ast)
print("Removing artifacts...")
documentation = stripartifacts(documentation)
print("Writing to file...")
with open("documentation.md", "w", encoding="utf-8") as file:
file.writelines(documentation)
print("Documentation generated and saved to documentation.md")
print("Done!")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\nExecution interrupted by user.")