tree-sitter-d2/Makefile

20 lines
431 B
Makefile
Raw Normal View History

2022-12-07 12:59:06 +03:00
TS_CONF := $$HOME/.config/tree-sitter/config.json
2022-12-04 00:07:26 +03:00
test: build
tree-sitter test
2022-12-07 12:59:06 +03:00
highlight: build
2022-12-07 11:58:45 +03:00
tree-sitter highlight -t test/highlight/*.d2
2022-12-04 00:07:26 +03:00
build:
tree-sitter generate
2022-12-07 11:58:45 +03:00
2022-12-07 12:59:06 +03:00
init:
if [ ! -f "$(TS_CONF)" ]; then \
tree-sitter init-config; \
fi
if [ -z $$(jq '."parser-directories"' $(TS_CONF) | grep $$(dirname $$PWD) ) ]; then \
jq ".\"parser-directories\" |= . + [\"$$(dirname $$PWD)\"]" $(TS_CONF) > $(TS_CONF); \
fi