Small Lua-based utility that generates license file in your current directory.
Use the following command:
sudo luarocks install licensegen
- Clone this project
- (optional) Add directory of this project to your
$PATH
variable - Use
licensegen
orlua licensegen.lua
licensegen <licensename> --<arg1>=<val1> --<arg2>=<val2> ...
There are also some options that do not create license file but output useful information:
-h
or--help
- Show help page-v
or--version
- Show version-a
or--aliases
- Show aliases-i
or--info
- Show detailed info about the license--list
or--licenses
- List all licenses--cfg
or--config
- Show config directory
Replace arguments must be set in the following format: --<arg>=<text>
, f.e. --owner=username
or --owner="Your Full Name"
. All arguments (with some exceptions) can be set in config and overwritten by CLI parameters.
There are some specific arguments that may be set automatically:
- aliases - Sets aliases for licenses (table, check
--aliases
for the full list) - filename - Name of the output file (
LICENSE
by default) - licensename -License type you want to use (only for config file)
- owner - Owner of the project (name of the current user by default)
- project - Name of the project (name of the current directory by default)
- workdir - Full path to the project
- year - Current year
If a user creates ~/.config/licensegen/
directory (for Unix) or %LOCALAPPDATA\licensegen\
folder, config.lua
from can be used to set default default values. For example:
return {
owner = "My Name",
aliases = {
bsd = "bsd-4-clause",
},
}
This config file sets My Name
as default $owner$
variable and bsd
is now an aliase to bsd-4-clause
.
While creating a custom license is generally a bad idea, this project doesn't list all existing licenses that you might need to use. In this case you can create folder licenses
in config directory and copy text of license template with .txt
extension. Keep in mind that "custom" licenses have higher priority over the "standard" ones.
All licenses were taken from choosealicense.com repo.