diff --git a/example-spdx-headers.md b/example-spdx-headers.md new file mode 100644 index 0000000..0644598 --- /dev/null +++ b/example-spdx-headers.md @@ -0,0 +1,81 @@ +# SPDX License Headers for CC0 1.0 Universal in the top 20 programming languages + +## JavaScript + +`// SPDX-License-Identifier: CC0-1.0` + +## Python + +`# SPDX-License-Identifier: CC0-1.0` + +## Java + +`/* SPDX-License-Identifier: CC0-1.0 */` + +## C++ + +`/* SPDX-License-Identifier: CC0-1.0 */` + +## Ruby + +`# SPDX-License-Identifier: CC0-1.0` + +## PHP + +`` + +## C\# + +`// SPDX-License-Identifier: CC0-1.0` + +## Go + +`// SPDX-License-Identifier: CC0-1.0` + +## TypeScript + +`// SPDX-License-Identifier: CC0-1.0` + +## Swift + +`// SPDX-License-Identifier: CC0-1.0` + +## Objective-C + +`// SPDX-License-Identifier: CC0-1.0` + +## Shell + +`# SPDX-License-Identifier: CC0-1.0` + +## Kotlin + +`/* SPDX-License-Identifier: CC0-1.0 */` + +## R + +`# SPDX-License-Identifier: CC0-1.0` + +## Scala + +`/* SPDX-License-Identifier: CC0-1.0 */` + +## Lua + +`-- SPDX-License-Identifier: CC0-1.0` + +## Perl + +`# SPDX-License-Identifier: CC0-1.0` + +## Haskell + +`-- SPDX-License-Identifier: CC0-1.0` + +## Groovy + +`/* SPDX-License-Identifier: CC0-1.0 */` + +## Rust + +`// SPDX-License-Identifier: CC0-1.0` \ No newline at end of file diff --git a/insert_license_headers.sh b/insert_license_headers.sh new file mode 100644 index 0000000..7c237df --- /dev/null +++ b/insert_license_headers.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# SPDX-License-Identifier: CC0-1.0 +# +# This script inserts an SPDX license header at the top of all files in a Git repository +# that do not already have the header. +# +# Usage: ./insert_license_headers.sh + +LICENSE_HEADER="// SPDX-License-Identifier: CC0-1.0" + +for file in $(git ls-files); do + if [ $(head -n 1 $file) != $LICENSE_HEADER ]; then + echo "Inserting license header into $file" + (echo $LICENSE_HEADER; cat $file) > /tmp/file + mv /tmp/file $file + fi +done \ No newline at end of file