about summary refs log tree commit diff stats
path: root/README.md
blob: 227b6410667e97f7730a93324877c25bc96a39e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# licensor: plop a license in there

Are you tired of copying and pasting licenses into your new projects?
Do you always forget what the dang github api thing is?
Or I don't know, have some other reason why doing licenses is hard?

Well now you don't have to worry!
Just run `licensor` in your new repo and BLAMMO!
Done.

## Installing

`licensor` comes with a Makefile for ease-of-installing, but it's just a shell
script.  You can drop it in your `$PATH`.

## Usage

literally taken from `licensor -h`:

```
licensor: easily provide a license for a project
USAGE: licensor [-h|-l|-L]
licensor -s QUERY
licensor [FLAGS] [OPTIONS] [LICENSE]

FLAGS:
-h   Display this help and exit.
-l   List available licenses and exit.
-L   List available licenses, disregarding cache.
     This flag will re-download the license repo.

-f   Overwrite existing license.
-q   Be quiet (don't log anything).
-z   Fold output to 70 characters (see -w).
-Z   Disable folding of output.
-p   Include "optional" license content.
-P   Don't include "optional" content.

OPTIONS:
-s QUERY        Search for a license matching QUERY.
                Only license titles are searched.

-y YEARS        Set copyright date(s) to YEARS.
                Default: $(date +%Y).
-a AUTHORS      Set copyright holder(s) to AUTHOR.
                Default: use the first of
                 - git config --get user.name
                 - getent password $USER
                 - $USER
 -e EMAILS         Set AUTHOR's EMAIL address.
                Default: $(git config --get user.email),
                or stay blank.
 -c COPYRIGHT   Set the entire COPYRIGHT string to print.
                By default, it's built from the above information:
                "Copyright (C) <year> <author> <email>".
 -w WIDTH       Fold the output to WIDTH characters.
                Default: 70.
 -o FILE        Output the fetched license to FILE.
                Default: $PWD/COPYING.

PARAMETERS:
 LICENSE        The license to use.
                Default: MIT.
```

You can use an output file of `-` (i.e., `licensor -o-`) to print the license to
stdout.

### Available licenses

Licenses are pulled from [SPDX][]'s [git repository of licenses][spdx-git].
This includes all of the more common licenses, and honestly, if you're wanting
to do something weird is `licensor` the right project for you?

*That being said, adding the ability for arbitrary license "repositories" is
probably for the best.*

[SPDX]: https://spdx.org/licenses/
[spdx-git]: https://github.com/spdx/license-list-data/

### Templating

SPDX uses a [particular templating format][spdx-template-format] that `licensor`
can read and use.  As of v1.0, only `beginOptional`/`endOptional` and
`var;name="copyright"` fields are filled in; all others are stripped from output.

## Configuring

There are some environment variables you can set to change `licensor`'s default
behavior:

- `LICENSE_REPO_VERSION` : 3.17
- `LICENSE_REPO_URL` : `https://github.com/spdx/license-list-data/archive/refs/tags/v$LICENSE_REPO_VERSION.tar.gz`
- `LICENSE_REPO_PATH` : `license-list-data-$LICENSE_REPO_VERSION/template`
- `LICENSOR_LICENSE` : MIT
- `LICENSOR_OUTPUT_FILE` : COPYING

## Contributing

Send me an [email](mailto:acdw@acdw.net).

## License

MIT, baby.

See [COPYING](https://git.acdw.net/licensor/tree/COPYING) for details.

## Author

Case Duckworth <acdw@acdw.net> wrote this.
He did not look around for existing solutions.