add new extensions
This commit is contained in:
12
main.go
12
main.go
@@ -276,7 +276,7 @@ func licenseHeader(path string, tmpl *template.Template, data licenseData) ([]by
|
|||||||
base := strings.ToLower(filepath.Base(path))
|
base := strings.ToLower(filepath.Base(path))
|
||||||
|
|
||||||
switch fileExtension(base) {
|
switch fileExtension(base) {
|
||||||
case ".c", ".h", ".gv", ".java", ".scala", ".kt", ".kts":
|
case ".c", ".h", ".gv", ".java", ".scala", ".kt", ".kts", ".qml":
|
||||||
lic, err = executeTemplate(tmpl, data, "/*", " * ", " */")
|
lic, err = executeTemplate(tmpl, data, "/*", " * ", " */")
|
||||||
case ".js", ".mjs", ".cjs", ".jsx", ".tsx", ".css", ".scss", ".sass", ".ts":
|
case ".js", ".mjs", ".cjs", ".jsx", ".tsx", ".css", ".scss", ".sass", ".ts":
|
||||||
lic, err = executeTemplate(tmpl, data, "/**", " * ", " */")
|
lic, err = executeTemplate(tmpl, data, "/**", " * ", " */")
|
||||||
@@ -290,7 +290,7 @@ func licenseHeader(path string, tmpl *template.Template, data licenseData) ([]by
|
|||||||
lic, err = executeTemplate(tmpl, data, "", "% ", "")
|
lic, err = executeTemplate(tmpl, data, "", "% ", "")
|
||||||
case ".hs", ".sql", ".sdl":
|
case ".hs", ".sql", ".sdl":
|
||||||
lic, err = executeTemplate(tmpl, data, "", "-- ", "")
|
lic, err = executeTemplate(tmpl, data, "", "-- ", "")
|
||||||
case ".html", ".xml", ".vue", ".wxi", ".wxl", ".wxs":
|
case ".html", ".xml", ".vue", ".wxi", ".wxl", ".wxs", ".ts":
|
||||||
lic, err = executeTemplate(tmpl, data, "<!--", " ", "-->")
|
lic, err = executeTemplate(tmpl, data, "<!--", " ", "-->")
|
||||||
case ".php":
|
case ".php":
|
||||||
lic, err = executeTemplate(tmpl, data, "", "// ", "")
|
lic, err = executeTemplate(tmpl, data, "", "// ", "")
|
||||||
@@ -298,11 +298,19 @@ func licenseHeader(path string, tmpl *template.Template, data licenseData) ([]by
|
|||||||
lic, err = executeTemplate(tmpl, data, "{#", "", "#}")
|
lic, err = executeTemplate(tmpl, data, "{#", "", "#}")
|
||||||
case ".ml", ".mli", ".mll", ".mly":
|
case ".ml", ".mli", ".mll", ".mly":
|
||||||
lic, err = executeTemplate(tmpl, data, "(**", " ", "*)")
|
lic, err = executeTemplate(tmpl, data, "(**", " ", "*)")
|
||||||
|
case ".ts":
|
||||||
|
lic, err = executeTemplate(tmpl, data, "/**", " * ", " */")
|
||||||
|
if err {
|
||||||
|
lic, err = executeTemplate(tmpl, data, "<!--", " ", "-->")
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
// handle various cmake files
|
// handle various cmake files
|
||||||
if base == "cmakelists.txt" || strings.HasSuffix(base, ".cmake.in") || strings.HasSuffix(base, ".cmake") {
|
if base == "cmakelists.txt" || strings.HasSuffix(base, ".cmake.in") || strings.HasSuffix(base, ".cmake") {
|
||||||
lic, err = executeTemplate(tmpl, data, "", "# ", "")
|
lic, err = executeTemplate(tmpl, data, "", "# ", "")
|
||||||
}
|
}
|
||||||
|
if base == "Jenkinsfile" || strings.HasSuffix(base, ".groovy" {
|
||||||
|
lic, err = executeTemplate(tmpl, data, "", "// ", "")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return lic, err
|
return lic, err
|
||||||
}
|
}
|
||||||
|
|||||||
2
tmpl.go
2
tmpl.go
@@ -89,7 +89,7 @@ func executeTemplate(t *template.Template, d licenseData, top, mid, bot string)
|
|||||||
return out.Bytes(), nil
|
return out.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const tmplCommercial = `Copyright {{.Holder}} {{ if .Year }} 2023-{{.Year}}{{ end }}
|
const tmplCommercial = `Copyright {{.Holder}} {{ if .Year }} {{.Year}}{{ end }}
|
||||||
|
|
||||||
You can not use the contents of the file in any way without
|
You can not use the contents of the file in any way without
|
||||||
AVROID, Ltd. written permission.
|
AVROID, Ltd. written permission.
|
||||||
|
|||||||
Reference in New Issue
Block a user