Merge pull request #144 from kupiakos/master

Add support for TOML configuration files
This commit is contained in:
Marc
2023-06-13 22:20:20 +01:00
committed by GitHub
3 changed files with 19 additions and 1 deletions

View File

@@ -295,7 +295,7 @@ func licenseHeader(path string, tmpl *template.Template, data licenseData) ([]by
lic, err = executeTemplate(tmpl, data, "/**", " * ", " */") lic, err = executeTemplate(tmpl, data, "/**", " * ", " */")
case ".cc", ".cpp", ".cs", ".go", ".hcl", ".hh", ".hpp", ".m", ".mm", ".proto", ".rs", ".swift", ".dart", ".groovy", ".v", ".sv": case ".cc", ".cpp", ".cs", ".go", ".hcl", ".hh", ".hpp", ".m", ".mm", ".proto", ".rs", ".swift", ".dart", ".groovy", ".v", ".sv":
lic, err = executeTemplate(tmpl, data, "", "// ", "") lic, err = executeTemplate(tmpl, data, "", "// ", "")
case ".py", ".sh", ".yaml", ".yml", ".dockerfile", "dockerfile", ".rb", "gemfile", ".tcl", ".tf", ".bzl", ".pl", ".pp", "build": case ".py", ".sh", ".yaml", ".yml", ".dockerfile", "dockerfile", ".rb", "gemfile", ".tcl", ".tf", ".bzl", ".pl", ".pp", "build", ".toml":
lic, err = executeTemplate(tmpl, data, "", "# ", "") lic, err = executeTemplate(tmpl, data, "", "# ", "")
case ".el", ".lisp": case ".el", ".lisp":
lic, err = executeTemplate(tmpl, data, "", ";; ", "") lic, err = executeTemplate(tmpl, data, "", ";; ", "")

16
testdata/expected/file.toml vendored Normal file
View File

@@ -0,0 +1,16 @@
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[package]
name = "not-a-real-crate"

2
testdata/initial/file.toml vendored Normal file
View File

@@ -0,0 +1,2 @@
[package]
name = "not-a-real-crate"