2023-08-27 20:49:23 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import json
|
|
|
|
|
|
|
|
tool_path = sys.argv[1]
|
|
|
|
|
|
|
|
tools = {
|
|
|
|
"linters": {},
|
|
|
|
"formatters": {},
|
|
|
|
}
|
|
|
|
|
|
|
|
for kind in ["linters", "formatters"]:
|
|
|
|
for file in os.listdir(tool_path + "/" + kind):
|
|
|
|
tool_name = file.removesuffix(".lua")
|
|
|
|
languages = []
|
|
|
|
with open(tool_path + "/" + kind + "/" + file) as f:
|
|
|
|
for line in f.readlines():
|
|
|
|
if line.startswith("-- languages:"):
|
2023-08-28 18:27:03 +02:00
|
|
|
languages = [
|
|
|
|
l.strip() for l in line.split(":")[1].strip().split(",")
|
|
|
|
]
|
2023-08-27 20:49:23 +02:00
|
|
|
break
|
|
|
|
tools[kind][tool_name] = languages
|
|
|
|
|
2023-08-28 13:48:46 +02:00
|
|
|
print(json.dumps(tools, indent=4, sort_keys=True))
|