about summary refs log tree commit diff stats
path: root/create_report.py
blob: 9d7cb57002ffa8f8b579f3ec600753aee3f86794 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from parse_data import parse_data
from jinja2 import Environment, FileSystemLoader
import argparse
import sys

parser = argparse.ArgumentParser(prog=sys.argv[0])
parser.add_argument('exe_path', help="executable to parse")
parser.add_argument('-o', '--out', help="output file (default: report.html)", default="report.html")
args = parser.parse_args()

data, stats = parse_data(args.executable)

# Load the template from the current directory
env = Environment(loader=FileSystemLoader('.'))
template = env.get_template("template.html")

# Render the template with data
html_output = template.render(data=data, stats=stats)

# Save the generated HTML to a file
with open(args.out, "w", encoding="utf-8") as f:
    f.write(html_output)

print(f"Report generated: {args.out}")