Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/marvin9/licensor

Painless license header injection. add, update and remove license header.
https://github.com/marvin9/licensor

Last synced: about 21 hours ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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.](https://github.com/Marvin9/licensor/releases/latest)

![](https://img.shields.io/github/v/release/Marvin9/licensor?label=latest)

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
```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.

![](./assets/licensor_demo.gif)

***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](https://medium.com/@mayursinhsarvaiya/add-license-to-your-source-code-with-licensor-34590e8b18bd)