Skip to content

ytyaru/lish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ja

lish

Create a LICENSE file.

asciinema

Features

Support licenses

Group License
copyleft AGPL(+), GPL(+), LGPL(+), CC-BY-SA-4.0
permissive Apache-2.0, MIT, BSD(2,3,3-clear), CC-BY-4.0
public-domain CC0, Unlicense
Approval

Approval

type FSF OSI License
copyleft AGPL
copyleft GPL
copyleft LGPL
copyleft CC-BY-SA-4.0
permissive Apache-2.0
permissive MIT
permissive BSD-2-Clause
permissive BSD-3-Clause
permissive BSD-3-Clause-Clear
permissive CC-BY-4.0
public-domain CC0-1.0
public-domain Unlicense

Requirement

$ uname -a
Linux raspberrypi 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l GNU/Linux

Installation

sudo apt install -y jq
sudo apt install -y ruby bundler cmake pkg-config git libssl-dev
sudo gem install licensee
git clone https://github.com/ytyaru/lish

Usage

Make symbolic link and set PATH environment variable

cd lish/src
ln -s ./lish.sh /usr/bin/lish

Show help

help

lish -h

Output license file

Licenses can be specified by alias.

lish p # public-domain CC0-1.0
lish l # copyleft      AGPL-3.0
lish c # copycenter    Apache-2.0

Output LICENSE file to the current directory.

Add filename suffix -i

Add license ID to file name suffix.

lish -i GPL

The output file name will be LICENSE-GPL-3.0-only.

Copyright options

Author name -a

MIT and BSD require author names.

lish -a AuthorName MIT

If there is a ./git/config file, use the value of git config --local user.name.

Copyright year -y

Optionally, you can specify the year of copyright issuance.

lish -a A -y 1999 MIT

If not specified, use the runtime year.

Selected License select

lish select
1) CC0		  3) AGPL	   5) LGPL	    7) CC-BY-SA	     9) MIT	     11) BSD-3
2) Unlicense	  4) GPL	   6) CC-BY	    8) Apache	    10) BSD-2	     12) BSD-3-Clear

MIT and BSD prompt for the author name.

Author name: 

Detect license

Returns the license type ID from the LICENSE file using licensee.

lish detect

If there are multiple licenses, change the LICENSE file name and output it to detect it.

$ lish -i l
$ lish -i c
$ lish detect
Apache-2.0
GPL-3.0

Output standard license header -s

The target is GPL, AGPL,CC0,Apache. headers. Source is SPDX v3.7 2019-10-22

lish -s GPL

Output to stdout.

Repository name -r

lish -s -r 'My Repo' GPL

Template values

For example, GPL is as follows.

{{REPO_NAME}}
Copyright (C) {{YEAR}} {{AUTHOR}}

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
template value
{{REPO_NAME}} -r option value. Or Current directory name
{{YEAR}} -y option value. Or run-time year
{{AUTHOR}} -a option value. Or git config --local user.name

Formatting

Wrap

On Linux, use the fold command to wrap lines in words other than 80 characters.

cat ./res/headers/gpl-3.0-only.txt | fold -s -w 80
{{REPO_NAME}}
Copyright (C) {{YEAR}} {{AUTHOR}}

This program is free software: you can redistribute it and/or modify it under 
the terms of the GNU General Public License as published by the Free Software 
Foundation, version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY 
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with 
this program. If not, see <https://www.gnu.org/licenses/>.

Line wrapping is not required for the standard license header of Apache-2.0. The line had already been wrapped.

Indent

cat ./res/headers/gpl-3.0-only.txt | sed -e 's/^/  /g'

Note

  • Some template file contents are duplicated
    • AGPL, GPL, LGPL
      • -only, -or-later
        • Just in case for future changes.

Author

ytyaru

  • github
  • hatena
  • mastodon

License

This software is CC0 licensed.

CC0