Skip to content

Latest commit

 

History

History
283 lines (200 loc) · 9.26 KB

README.ja.md

File metadata and controls

283 lines (200 loc) · 9.26 KB

en

lish

 LICENSEファイルを生成する。

asciinema

特徴

対応ライセンス

系列 ライセンス
コピーレフト AGPL(+), GPL(+), LGPL(+), CC-BY-SA-4.0
パーミッシブ Apache-2.0, MIT, BSD(2,3,3-clear), CC-BY-4.0
パブリックドメイン CC0, Unlicense
承認

承認

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

開発環境

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

インストール

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

使い方

シンボリックリンク作成&パスに通す

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

ヘルプ表示

 ヘルプ

lish -h

ライセンスファイル出力

 ライセンスはエイリアスで指定できる。

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

 LICENSEファイルを現在のディレクトリに出力する。

ファイル名に接尾辞を追加 -i

 ライセンスIDをファイル名のサフィックスに追加する。

lish -i GPL

 上記の場合、出力ファイル名はLICENSE-GPL-3.0-onlyである。

著作権表示オプション

著者名 -a

 MITBSDには著者名が必要。

lish -a 'First Last' MIT

 ./git/configファイルがある場合、git config --local user.nameの値を使用する。

著作権発行年 -y

 オプションで、著作権の発行年を指定できる。

lish -a A -y 1999 MIT

 指定しない場合は、実行時の年を使用する。

ライセンス選択 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

MITBSDでは著者名の入力を求めることがある。

Author name: 

ライセンス検出

licenseeを使用して、 LICENSEファイルからライセンスIDを返す。

lish detect

 以下、複数のライセンスがある場合の例。 LICENSEファイル名を変更して出力し併存させ、検出する。

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

標準ライセンスヘッダ出力 -s

 ターゲットはGPL, AGPL,CC0,Apacheheaders. 情報源はSPDX v3.7 2019-10-22

lish -s GPL

 標準出力stdoutに出力する。

リポジトリ名 -r

lish -s -r 'My Repo' GPL

テンプレート値

 たとえばGPLは次のとおり。

{{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/>.
テンプレート
{{REPO_NAME}} -rオプションの値。または現在のディレクトリ名
{{YEAR}} -yオプションの値。 または実行時の年
{{AUTHOR}} -aオプションの値。 または git config --local user.name

整形

行の折返し

 80文字以外の単語で行を折り返す。Linuxではfoldコマンドを使う。

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

 Apache-2.0の標準ライセンスヘッダは行の折り返しが不要。既にされている。

インデント

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

注意

  • 一部のテンプレートファイルの内容が重複しています
    • AGPL, GPL, LGPL
      • -only, -or-later              * 将来の変更に備えて念の為

著者

 ytyaru

  • github
  • hatena
  • mastodon

ライセンス

 このソフトウェアはCC0ライセンスである。

CC0