tree-sitter-d2/Makefile

27 lines
544 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-07 18:52:19 +03:00
playground: build-wasm
tree-sitter playground --quiet
build-wasm: build
tree-sitter build-wasm
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 \
2022-12-07 13:34:05 +03:00
cat <<< $$(jq ".\"parser-directories\" |= . + [\"$$(dirname $(PWD))\"]" $(TS_CONF)) > $(TS_CONF); \
2022-12-07 12:59:06 +03:00
fi
2022-12-07 15:30:45 +03:00