fix: add DESCRIPTION to grammar Makefile template

This commit is contained in:
Will Lillis 2026-06-07 17:31:41 -04:00
parent 2fddf5a1b4
commit e502c6c18e
2 changed files with 14 additions and 0 deletions

View file

@ -737,6 +737,19 @@ pub fn generate_grammar_files(
"}
);
}
if !contents.contains("\nDESCRIPTION :=") {
if let Some(version_line) = contents.lines().find(|l| l.starts_with("VERSION := ")) {
info!("Adding DESCRIPTION to Makefile");
let description = generate_opts.description.map_or_else(
|| format!("{} grammar for tree-sitter", generate_opts.camel_parser_name),
str::to_string,
);
contents = contents.replace(
version_line,
&format!("{version_line}\nDESCRIPTION := {description}"),
);
}
}
write_file(path, contents)?;
}
Ok(())

View file

@ -1,6 +1,7 @@
LANGUAGE_NAME := tree-sitter-KEBAB_PARSER_NAME
HOMEPAGE_URL := PARSER_URL
VERSION := PARSER_VERSION
DESCRIPTION := PARSER_DESCRIPTION
# repository
SRC_DIR := src