haldis/app/parse_hlds.py
Jan-Pieter Baert 5e29f2a5f7
Fix formatting
2022-04-19 22:04:49 +02:00

30 lines
688 B
Python
Executable file

#!/usr/bin/env python3
from hlds.parser import parse_files
USAGE = """{0} [filename]...
Parse HLDS files, print as JSON
Without arguments, parse the default definitions.
With filenames as arguments, parse those files as HLDS.
{} --help Print this help text"""
def main(filenames):
if filenames:
location_definitions = parse_files(filenames)
else:
from hlds.definitions import location_definitions
print("\n\n".join(map(str, location_definitions)))
if __name__ == "__main__":
import sys
args = sys.argv[1:]
if "-h" in args or "--help" in args:
print(USAGE.format(sys.argv[0]), file=sys.stderr)
else:
main(args)