extensions.py: use argparse for arguments

We're going to make more use of this later
This commit is contained in:
Dylan Baker 2024-12-03 10:50:42 -08:00
parent f25753ddd0
commit c4c32acbae

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python
import argparse
import sys
from xml.etree.cElementTree import parse
@ -111,14 +112,18 @@ def emit_module(module, output):
def main():
# Parse the xml file
output_file = sys.argv[1]
parser = argparse.ArgumentParser()
parser.add_argument('output')
parser.add_argument('inputs', nargs='+')
args = parser.parse_args()
modules = []
for input_file in sys.argv[2:]:
for input_file in args.inputs:
parseFile(input_file, modules)
assert xproto != None
with open(output_file, "w") as output:
with open(args.output, "w") as output:
output.write("/* Auto-generated file, do not edit */\n")
output.write('#include "errors.h"\n')
output.write("#include <string.h>\n")