Skip to content

ichigoproject/addlicense

Repository files navigation


Addlicense

Add any license header on all files.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Install
  3. Usage
  4. License

About The Project

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.

This project is an fork from 'addlicense' by Google Inc with GNU support.

Install

For Debian/Ubuntu users:

sudo echo "deb [trusted=yes] https://repo.ichigoproject.org/apt/ /" > /etc/apt/sources.list.d/ichigo.list
sudo apt update
sudo apt install addlicense

For RHEL users:

sudo vi /etc/yum.repos.d/ichigo.repo

# Add this content in /etc/yum.repos.d/ichigo.repo 
[ichigo]
name=Ichigo Project official repository
baseurl=https://repo.ichigoproject.org/yum/
enabled=1
gpgcheck=0

sudo yum update
sudo yum install addlicense

Usage

Usage: addlicense [flags] pattern [pattern ...]

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.

The pattern argument can be provided multiple times, and may also refer
to single files.

Flags:

  -c string
        copyright holder (default "Ichigo Project")
  -check
        check only mode: verify presence of license headers and exit with non-zero code if missing
  -f string
        license file
  -l string
        license type: apache, bsd, mit, mpl, gnu (default "gnu")
  -p int
        number of files to open in parallel (default 1000)
  -skip value
        To skip files to check/add the header file, for example: -skip rb -skip go
  -v    verbose mode: print the name of the files that are modified
  -y string
        copyright year(s) (default "2021")

The pattern argument can be provided multiple times, and may also refer to single files.

Example

Add "apache" license header on all files.

addlicense -l apache -c "My company" path/to/your/code/

Check if headers is present or not (in current directory):

addlicense -check .

License

Distributed under the Apache 2.0 license. See LICENSE for more information.