Skip to content

Commit a911506

Browse files
authored
Add script to add file license headers (#4690)
1 parent 9d4d89f commit a911506

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

build/add-headers.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
script_path=$(dirname $(realpath -s $0))/../
4+
5+
6+
(find "$script_path" -name "*.fs" | grep -v "/bin/" | grep -v "/obj/")|while read fname; do
7+
line=$(head -n 1 "$fname")
8+
if [[ "$line" =~ ^/ ]] || [[ "$line" =~ ^# ]] ; then
9+
echo "Skipped already starts with / or #: $fname"
10+
else
11+
cat "${script_path}build/file-header.txt" "$fname" > "${fname}.new"
12+
mv "${fname}.new" "$fname"
13+
fi
14+
done
15+
16+
(find "$script_path" -name "*.cs" | grep -v "/bin/" | grep -v "/obj/")|while read fname; do
17+
line=$(head -n 1 "$fname")
18+
if [[ "$line" =~ ^/ ]] || [[ "$line" =~ ^# ]] ; then
19+
echo "Skipped already starts with / or #: $fname"
20+
else
21+
cat "${script_path}build/file-header.txt" "$fname" > "${fname}.new"
22+
mv "${fname}.new" "$fname"
23+
fi
24+
done

build/file-header.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+

0 commit comments

Comments
 (0)