diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-04-01 13:09:55 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-04-01 13:09:55 +0200 |
commit | d37315e8a9cb012ed82898d623235abc62d3e3f9 (patch) | |
tree | d2b2036bb4b53aba523bb135e32ff64c3b4e9ab7 /templates/rust/scripts/renew_copyright_header.sh | |
parent | fix(common/scripts/renew_copyright_header): Add support for TeX files (diff) | |
download | flake-templates-d37315e8a9cb012ed82898d623235abc62d3e3f9.tar.gz flake-templates-d37315e8a9cb012ed82898d623235abc62d3e3f9.zip |
chore(version): v0.4.1
Diffstat (limited to 'templates/rust/scripts/renew_copyright_header.sh')
-rwxr-xr-x | templates/rust/scripts/renew_copyright_header.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/templates/rust/scripts/renew_copyright_header.sh b/templates/rust/scripts/renew_copyright_header.sh index edb0a65..4f424c3 100755 --- a/templates/rust/scripts/renew_copyright_header.sh +++ b/templates/rust/scripts/renew_copyright_header.sh @@ -3,6 +3,7 @@ # NOTE: This is the line length of the .licensure.yml header template **plus** the extra # line after the template comment. TEMPLATE_LINE_LENGTH=20 +LATEX_TEMPLATE_LINE_LENGTH=9 PROJECT_ROOT="$(git rev-parse --show-toplevel)" @@ -17,6 +18,11 @@ remove() { "Makefile" | "toml" | "envrc" | "yml" | "gitignore" | "awk") sed --in-place "1,${TEMPLATE_LINE_LENGTH}d" "$file" ;; + # LaTeX files (or TeX files in general) have a different license, use the + # $LATEX_TEMPLATE_LINE_LENGTH variable. + "tex") + sed --in-place "1,${LATEX_TEMPLATE_LINE_LENGTH}d" "$file" + ;; # normal '/* ... */' like comments (these are $TEMPLATE_LINE_LENGTH + 2 lines long) "c" | "h" | "md" | "rs") length="$((TEMPLATE_LINE_LENGTH + 2))" @@ -66,7 +72,7 @@ if [ -f "$1" ]; then fi else fd --type file --hidden . | while read -r file; do - if grep --quiet 'SPDX-License-Identifier: GPL-3.0-or-later' "$file"; then + if grep --quiet 'SPDX-License-Identifier' "$file"; then filename="$(basename -- "$file")" extension="${filename##*.}" filename="${filename%.*}" |