6 """ Python script to execute tree-sitter generate in the right output folder,
7 necessary because tree-sitter generate does not allow to specify it """
15 if len(sys.argv) <= 3:
17 "Usage: {} <tree-sitter-path> <output-dir> <grammar.js>".format(sys.argv[0])
21 tree_sitter_exe = sys.argv[1]
22 output_dir = sys.argv[2]
23 grammar_js = sys.argv[3]
25 return tree_sitter_exe, output_dir, grammar_js
29 tree_sitter_exe, output_dir, grammar_js =
parse()
31 grammar_js = os.path.abspath(grammar_js)
32 output_dir = os.path.abspath(output_dir)
33 tree_sitter_exe = os.path.abspath(tree_sitter_exe)
36 [tree_sitter_exe,
"generate", grammar_js], check=
True, cwd=output_dir
40 if __name__ ==
"__main__":