feat: add support for cmake files
Co-authored-by: Sergii Baitala <sbaitala@gmail.com>
This commit is contained in:
5
main.go
5
main.go
@@ -306,6 +306,11 @@ func licenseHeader(path string, tmpl *template.Template, data licenseData) ([]by
|
||||
lic, err = executeTemplate(tmpl, data, "", "// ", "")
|
||||
case ".ml", ".mli", ".mll", ".mly":
|
||||
lic, err = executeTemplate(tmpl, data, "(**", " ", "*)")
|
||||
default:
|
||||
// handle various cmake files
|
||||
if base == "cmakelists.txt" || strings.HasSuffix(base, ".cmake.in") || strings.HasSuffix(base, ".cmake") {
|
||||
lic, err = executeTemplate(tmpl, data, "", "# ", "")
|
||||
}
|
||||
}
|
||||
return lic, err
|
||||
}
|
||||
|
||||
10
main_test.go
10
main_test.go
@@ -339,6 +339,16 @@ func TestLicenseHeader(t *testing.T) {
|
||||
[]string{"f.ml", "f.mli", "f.mll", "f.mly"},
|
||||
"(**\n HYS\n*)\n\n",
|
||||
},
|
||||
{
|
||||
[]string{"cmakelists.txt", "f.cmake", "f.cmake.in"},
|
||||
"# HYS\n\n",
|
||||
},
|
||||
|
||||
// ensure matches are case insenstive
|
||||
{
|
||||
[]string{"F.PY", "DoCkErFiLe"},
|
||||
"# HYS\n\n",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user