Skip to content

Commit

Permalink
Merge branch 'master' into feat/powershell
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebAlbers authored Aug 12, 2022
2 parents 86e5288 + a001da4 commit 3a019cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,15 @@ func licenseHeader(path string, tmpl *template.Template, data licenseData) ([]by
lic, err = executeTemplate(tmpl, data, "/**", " * ", " */")
case ".cc", ".cpp", ".cs", ".go", ".hcl", ".hh", ".hpp", ".m", ".mm", ".proto", ".rs", ".swift", ".dart", ".groovy", ".v", ".sv":
lic, err = executeTemplate(tmpl, data, "", "// ", "")
case ".py", ".sh", ".yaml", ".yml", ".dockerfile", "dockerfile", ".rb", "gemfile", ".tcl", ".bzl", ".pl", ".pp", ".ps1", ".psd1", ".psm1":
case ".py", ".sh", ".yaml", ".yml", ".dockerfile", "dockerfile", ".rb", "gemfile", ".nomad", ".ru", ".tcl", ".tfvars", ".bzl", ".pl", ".pp", ".ps1", ".psd1", ".psm1":
lic, err = executeTemplate(tmpl, data, "", "# ", "")
case ".el", ".lisp":
lic, err = executeTemplate(tmpl, data, "", ";; ", "")
case ".erl":
lic, err = executeTemplate(tmpl, data, "", "% ", "")
case ".hs", ".sql", ".sdl":
lic, err = executeTemplate(tmpl, data, "", "-- ", "")
case ".html", ".xml", ".vue", ".wxi", ".wxl", ".wxs":
case ".html", ".htm", ".xml", ".vue", ".wxi", ".wxl", ".wxs":
lic, err = executeTemplate(tmpl, data, "<!--", " ", "-->")
case ".php":
lic, err = executeTemplate(tmpl, data, "", "// ", "")
Expand Down Expand Up @@ -331,6 +331,7 @@ var head = []string{
"<!doctype", // HTML doctype
"# encoding:", // Ruby encoding
"# frozen_string_literal:", // Ruby interpreter instruction
"#\\", // Ruby Rack directive https://github.com/rack/rack/wiki/(tutorial)-rackup-howto
"<?php", // PHP opening tag
"# escape", // Dockerfile directive https://docs.docker.com/engine/reference/builder/#parser-directives
"# syntax", // Dockerfile directive https://docs.docker.com/engine/reference/builder/#parser-directives
Expand Down
5 changes: 3 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ func TestAddLicense(t *testing.T) {
{"<!DOCTYPE HTML>\ncontent", "<!DOCTYPE HTML>\n// HYS\n\ncontent", true},
{"# encoding: UTF-8\ncontent", "# encoding: UTF-8\n// HYS\n\ncontent", true},
{"# frozen_string_literal: true\ncontent", "# frozen_string_literal: true\n// HYS\n\ncontent", true},
{"#\\ -w -p 8765\ncontent", "#\\ -w -p 8765\n// HYS\n\ncontent", true},
{"<?php\ncontent", "<?php\n// HYS\n\ncontent", true},
{"# escape: `\ncontent", "# escape: `\n// HYS\n\ncontent", true},
{"# syntax: docker/dockerfile:1.3\ncontent", "# syntax: docker/dockerfile:1.3\n// HYS\n\ncontent", true},
Expand Down Expand Up @@ -316,7 +317,7 @@ func TestLicenseHeader(t *testing.T) {
"// HYS\n\n",
},
{
[]string{"f.py", "f.sh", "f.yaml", "f.yml", "f.dockerfile", "dockerfile", "f.rb", "gemfile", "f.tcl", "f.bzl", "f.pl", "f.pp", ".ps1", ".psd1", ".psm1"},
[]string{"f.py", "f.sh", "f.yaml", "f.yml", "f.dockerfile", "dockerfile", "f.rb", "gemfile", ".ru", "f.tcl", "f.bzl", "f.pl", "f.pp", ".ps1", ".psd1", ".psm1", "f.nomad", "f.tfvars"},
"# HYS\n\n",
},
{
Expand All @@ -332,7 +333,7 @@ func TestLicenseHeader(t *testing.T) {
"-- HYS\n\n",
},
{
[]string{"f.html", "f.xml", "f.vue", "f.wxi", "f.wxl", "f.wxs"},
[]string{"f.html", "f.htm", "f.xml", "f.vue", "f.wxi", "f.wxl", "f.wxs"},
"<!--\n HYS\n-->\n\n",
},
{
Expand Down

0 comments on commit 3a019cc

Please sign in to comment.