Skip to content

Painless license header injection. add, update and remove license header.

License

Notifications You must be signed in to change notification settings

Marvin9/licensor

Repository files navigation

licensor

Inject custom license header in your source code, quickly.

Features

  • You can add custom license header to infinite files automatically.
  • If you want to change license, you can. Just minor modification is required in configuration.
  • You can also remove all the license header that was added by licensor.

Installation

Download latest binary.

Unzip tar

Linux/MacOS

make binary access global.

sudo mv /path/to/zip/licensor /usr/local/bin

Windows

create folder to store licensor.exe at any stable place and set path in environment.

Suppose licensor.exe is at C:\licensor\licensor.exe

SET "PATH=C:\licensor;%PATH%"

Usage

Using command line

licensor -project ./ -ext go js -license ./LICENSE.md
Flag Usage Example Required Default
-help . licensor -help false
-project Project directory path. licensor -project ./
licensor -project ./app
false ./
-ext Extensions of files which you want to add license header licensor -ext go py c cpp true
-license Custom license template which you want to add in source code. You can provide path or url. licensor -license Your-License-Template.txt
licensor -license url-that-returns-license-text
true
-template Variables value for your license template licensor -template "{\"foo\":\"bar\"}" Only if license template required
-ignore File(s)/Dir(s) to ignore licensor -ignore ./foo ./bar/a.go false

Using YML

licensor
  • licensor.yml
project: #[project directory path] [default: "./"]
extensions: #[required]
 - go
 - py
 - c
license: #[license file path or url] [required]
# Example license template:
# Copyright {{year}} {{owner}}
# template should be
template:
 year: 2020
 owner: Mayursinh Sarvaiya
ignore:
 - ./foo #[directory]
 - ./bar/baz.go #[file]

Demo

Experiment on kubernetes 8000+ go files.

Commands used:

# to inject license header
licensor -ext go -license ./LICENSE -ignore ./vendor

# to remove license header
licensor -ext go -remove -ignore ./vendor

Read article on medium

About

Painless license header injection. add, update and remove license header.

Resources

License

Stars

Watchers

Forks

Packages

No packages published