aboutsummaryrefslogtreecommitdiff
path: root/reqs2tex.py
blob: 68c8f40ca0fe457c6cad7aa17fe2ea3649b4bba4 (plain)
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
#!/bin/python3
import sys, tomllib

def fmt(data):
  print(data)
  return f"""
\\makeatletter
\\makeatother
"""

def main(input_file):
  data = {}
  with open(input_file, "rb") as file:
    data = tomllib.load(file)

  output = fmt(data)

  output_file = input_file.removesuffix(".toml") + ".tex"
  with open(output_file, "w+") as file:
    file.write(output)

if __name__ == "__main__":
  if len(sys.argv) != 2:
    print("usage: reqs2tex.py reqs.toml")
    exit(1)
  main(sys.argv[1])