2020-01-26 00:04:29 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2020-01-27 19:32:03 +01:00
|
|
|
from hlds.parser import parse_files
|
2020-01-26 00:04:29 +01:00
|
|
|
|
|
|
|
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):
|
2020-01-26 01:29:19 +01:00
|
|
|
if filenames:
|
|
|
|
location_definitions = parse_files(filenames)
|
|
|
|
else:
|
2020-01-27 19:32:03 +01:00
|
|
|
from hlds.definitions import location_definitions
|
2020-01-26 01:29:19 +01:00
|
|
|
|
|
|
|
print("\n\n".join(map(str, location_definitions)))
|
2020-01-26 00:04:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
import sys
|
2020-07-17 11:40:15 +02:00
|
|
|
|
2020-01-26 00:04:29 +01:00
|
|
|
args = sys.argv[1:]
|
|
|
|
if "-h" in args or "--help" in args:
|
|
|
|
print(USAGE.format(sys.argv[0]), file=sys.stderr)
|
|
|
|
else:
|
|
|
|
main(args)
|