tree-sitter-d2/Makefile

34 lines
694 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-10 23:00:30 +03:00
init: init-tree-sitter init-git-hooks
init-tree-sitter:
2022-12-07 12:59:06 +03:00
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
2022-12-10 23:00:30 +03:00
init-git-hooks:
ln -s $(PWD)/scripts/pre-commit $(PWD)/.git/hooks/pre-commit
2023-01-05 16:19:01 +03:00
help:
cat Makefile