Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/google/addlicense
A program which ensures source code files have copyright license headers by scanning directory patterns recursively
https://github.com/google/addlicense
license utility
Last synced: 2 months ago
JSON representation
A program which ensures source code files have copyright license headers by scanning directory patterns recursively
- Host: GitHub
- URL: https://github.com/google/addlicense
- Owner: google
- License: apache-2.0
- Created: 2016-06-27T10:37:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-08T15:02:11.000Z (6 months ago)
- Last Synced: 2024-08-01T12:17:38.996Z (5 months ago)
- Topics: license, utility
- Language: Go
- Homepage:
- Size: 109 KB
- Stars: 701
- Watchers: 12
- Forks: 169
- Open Issues: 51
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-tools - addlicense - A program which ensures source code files have copyright license headers by scanning directory patterns recursively. (Programming / Go)
README
# addlicense
The program ensures source code files have copyright license headers
by scanning directory patterns recursively.It modifies all source files in place and avoids adding a license header
to any file that already has one.addlicense requires go 1.16 or later.
## install
go install github.com/google/addlicense@latest
## usage
addlicense [flags] pattern [pattern ...]
-c copyright holder (default "Google LLC")
-check check only mode: verify presence of license headers and exit with non-zero code if missing
-f license file
-ignore file patterns to ignore, for example: -ignore **/*.go -ignore vendor/**
-l license type: apache, bsd, mit, mpl (default "apache")
-s Include SPDX identifier in license header. Set -s=only to only include SPDX identifier.
-v verbose mode: print the name of the files that are modified
-y copyright year(s) (default is the current year)The pattern argument can be provided multiple times, and may also refer
to single files. Directories are processed recursively.For example, to run addlicense across everything in the current directory and
all subdirectories:addlicense .
The `-ignore` flag can use any pattern [supported by
doublestar](https://github.com/bmatcuk/doublestar#patterns).## Running in a Docker Container
The simplest way to get the addlicense docker image is to pull from GitHub
Container Registry:```bash
docker pull ghcr.io/google/addlicense:latest
```Alternately, you can build it from source yourself:
```bash
docker build -t ghcr.io/google/addlicense .
```Once you have the image, you can test that it works by running:
```bash
docker run -it ghcr.io/google/addlicense -h
```Finally, to run it, mount the directory you want to scan to `/src` and pass the
appropriate addlicense flags:```bash
docker run -it -v ${PWD}:/src ghcr.io/google/addlicense -c "Google LLC" *.go
```## license
Apache 2.0
This is not an official Google product.