<p align="center">

<a href="https://github.com/generate/generate">
<img height="150" width="150" src="https://raw.githubusercontent.com/generate/generate/master/docs/logo.png">
</a>
</p>

Generate a license file for a GitHub project.

# generate-license

[![NPM version](https://img.shields.io/npm/v/generate-license.svg?style=flat)](https://www.npmjs.com/package/generate-license) [![NPM downloads](https://img.shields.io/npm/dm/generate-license.svg?style=flat)](https://npmjs.org/package/generate-license) [![Build Status](https://img.shields.io/travis/generate/generate-license.svg?style=flat)](https://travis-ci.org/generate/generate-license)

![generate-license demo](https://raw.githubusercontent.com/generate/generate-license/master/docs/demo.gif)

## Table of Contents

- [Quickstart](#quickstart)
- [CLI or API usage](#cli-or-api-usage)
- [Choose a license](#choose-a-license)
- [Available licenses](#available-licenses)
- [What is "Generate"?](#what-is-generate)
- [Getting started](#getting-started)
  * [Install](#install)
  * [Usage](#usage)
  * [Help](#help)
- [About](#about)
  * [Related projects](#related-projects)
  * [Community](#community)
  * [Contributors](#contributors)
  * [Contributing](#contributing)
  * [Running tests](#running-tests)
  * [Release history](#release-history)
  * [Author](#author)
  * [License](#license)

_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_

## Quickstart

**Install**

Install [generate](https://github.com/generate/generate) and `generate-license`:

```sh
$ npm install --global generate generate-license
```

**Generate a LICENSE**

Initiate a prompt to generate a `LICENSE` file to the current working directory:

```sh
$ gen license
```

## What is "Generate"?

Generate is a command line tool and developer framework for scaffolding out new GitHub projects using [generators](https://github.com/generate/generate/blob/master/docs/generators.md) and [tasks](https://github.com/generate/generate/blob/master/docs/tasks.md).

Answers to prompts and the user's environment can be used to determine the templates, directories, files and contents to build. Support for [gulp](http://gulpjs.com), [base](https://github.com/node-base/base) and [assemble](https://github.com/assemble/assemble) plugins, and much more.

**For more information**:

* Visit the [generate project](https://github.com/generate/generate/)
* Visit the [generate documentation](https://github.com/generate/generate/blob/master/docs/)
* Find [generators on npm](https://www.npmjs.com/browse/keyword/generate-generator) (help us [author generators](https://github.com/generate/generate/blob/master/docs/micro-generators.md))

## Getting started

### Install

**Installing the CLI**

To run the `license` generator from the command line, you'll need to install [Generate](https://github.com/generate/generate) globally first. You can do that now with the following command:

```sh
$ npm install --global generate
```

This adds the `gen` command to your system path, allowing it to be run from any directory.

**Install generate-license**

Install this module with the following command:

```sh
$ npm install --global generate-license
```

### Usage

Run this generator's `default` [task](https://github.com/generate/generate/blob/master/docs/tasks.md#default) with the following command:

```sh
$ gen license
```

**What you should see in the terminal**

If completed successfully, you should see both `starting` and `finished` events in the terminal, like the following:

```sh
[00:44:21] starting ...
...
[00:44:22] finished ✔
```

If you do not see one or both of those events, please [let us know about it](../../issues).

### Help

To see a general help menu and available commands for Generate's CLI, run:

```sh
$ gen help
```

## CLI or API usage

* tasks are used to generate files
* each task only generates a single license file, with the exception of the LGPL-3.0 license, which generates both the GPL-3.0 and LGPL-3.0 license files
* there are two tasks for every license listed at [github/choosealicense.com](https://github.com/github/choosealicense.com). One for ease-of-use when generating files by command line (e.g. `mit`), and one for semantic usage for when this generator is used as a plugin in another generator (e.g. `license-mit`)

**CLI usage example**

To generate a license, you must run the task associated with license you want to generate. For example, the following will run the `mit` task from `generate-license`:

```js
$ gen license:mit
```

**API usage: plugin example**

When used as a plugin, this generator's tasks will be added to your own generator's instance:

```js
module.exports = function(app) {
  app.use(require('generate-license'));

  // generate the `mit` license
  app.task('default', ['license-mit']);
};
```

**API usage: sub-generator example**

When used as a sub-generator, this generator's tasks will be namespaced on a separate instance, so tasks must be called using the `.generate` method:

```js
module.exports = function(app) {
  // use any name you want to register the generator
  app.register('whatever', require('generate-license'));

  // generate the `mit` license
  app.task('default', function(cb) {
    app.generate('whatever', ['license-mit'], cb);
  });
};
```

## Choose a license

### [default](generator.js#L44)

The `default` task prompts you to choose the `LICENSE` to generate. All licenses from [github/choosealicense.com](https://github.com/github/choosealicense.com) are available.

**Example**

```sh
$ gen license
$ gen license --dest ./docs
# or
$ gen license:choose
$ gen license:choose --dest ./docs
```

## Available licenses

All of the `LICENSE` templates from [github/choosealicense.com](https://github.com/github/choosealicense.com) are available.

#### [afl-3.0](generators/tasks.js#L17)

Generate a(n) `afl-3.0` license file to the current working directory.

**Example**

```sh
$ gen license:afl-3.0
$ gen license:afl-3.0 --dest ./foo
```

#### [apache-2.0](generators/tasks.js#L33)

Generate a(n) `apache-2.0` license file to the current working directory.

**Example**

```sh
$ gen license:apache-2.0
$ gen license:apache-2.0 --dest ./foo
```

#### [artistic-2.0](generators/tasks.js#L49)

Generate a(n) `artistic-2.0` license file to the current working directory.

**Example**

```sh
$ gen license:artistic-2.0
$ gen license:artistic-2.0 --dest ./foo
```

#### [bsd-2-clause](generators/tasks.js#L65)

Generate a(n) `bsd-2-clause` license file to the current working directory.

**Example**

```sh
$ gen license:bsd-2-clause
$ gen license:bsd-2-clause --dest ./foo
```

#### [bsd-3-clause](generators/tasks.js#L81)

Generate a(n) `bsd-3-clause` license file to the current working directory.

**Example**

```sh
$ gen license:bsd-3-clause
$ gen license:bsd-3-clause --dest ./foo
```

#### [bsd-3-clause-clear](generators/tasks.js#L97)

Generate a(n) `bsd-3-clause-clear` license file to the current working directory.

**Example**

```sh
$ gen license:bsd-3-clause-clear
$ gen license:bsd-3-clause-clear --dest ./foo
```

#### [cc-by-4.0](generators/tasks.js#L113)

Generate a(n) `cc-by-4.0` license file to the current working directory.

**Example**

```sh
$ gen license:cc-by-4.0
$ gen license:cc-by-4.0 --dest ./foo
```

#### [cc-by-sa-4.0](generators/tasks.js#L129)

Generate a(n) `cc-by-sa-4.0` license file to the current working directory.

**Example**

```sh
$ gen license:cc-by-sa-4.0
$ gen license:cc-by-sa-4.0 --dest ./foo
```

#### [cc0-1.0](generators/tasks.js#L145)

Generate a(n) `cc0-1.0` license file to the current working directory.

**Example**

```sh
$ gen license:cc0-1.0
$ gen license:cc0-1.0 --dest ./foo
```

#### [wtfpl](generators/tasks.js#L161)

Generate a(n) `wtfpl` license file to the current working directory.

**Example**

```sh
$ gen license:wtfpl
$ gen license:wtfpl --dest ./foo
```

#### [epl-1.0](generators/tasks.js#L177)

Generate a(n) `epl-1.0` license file to the current working directory.

**Example**

```sh
$ gen license:epl-1.0
$ gen license:epl-1.0 --dest ./foo
```

#### [eupl-1.1](generators/tasks.js#L193)

Generate a(n) `eupl-1.1` license file to the current working directory.

**Example**

```sh
$ gen license:eupl-1.1
$ gen license:eupl-1.1 --dest ./foo
```

#### [agpl-3.0](generators/tasks.js#L209)

Generate a(n) `agpl-3.0` license file to the current working directory.

**Example**

```sh
$ gen license:agpl-3.0
$ gen license:agpl-3.0 --dest ./foo
```

#### [gpl-2.0](generators/tasks.js#L225)

Generate a(n) `gpl-2.0` license file to the current working directory.

**Example**

```sh
$ gen license:gpl-2.0
$ gen license:gpl-2.0 --dest ./foo
```

#### [gpl-3.0](generators/tasks.js#L241)

Generate a(n) `gpl-3.0` license file to the current working directory.

**Example**

```sh
$ gen license:gpl-3.0
$ gen license:gpl-3.0 --dest ./foo
```

#### [lgpl-2.1](generators/tasks.js#L257)

Generate a(n) `lgpl-2.1` license file to the current working directory.

**Example**

```sh
$ gen license:lgpl-2.1
$ gen license:lgpl-2.1 --dest ./foo
```

#### [lgpl-3.0](generators/tasks.js#L273)

Generate a(n) `lgpl-3.0` license file to the current working directory.

**Example**

```sh
$ gen license:lgpl-3.0
$ gen license:lgpl-3.0 --dest ./foo
```

#### [isc](generators/tasks.js#L289)

Generate a(n) `isc` license file to the current working directory.

**Example**

```sh
$ gen license:isc
$ gen license:isc --dest ./foo
```

#### [lppl-1.3c](generators/tasks.js#L305)

Generate a(n) `lppl-1.3c` license file to the current working directory.

**Example**

```sh
$ gen license:lppl-1.3c
$ gen license:lppl-1.3c --dest ./foo
```

#### [mit](generators/tasks.js#L321)

Generate a(n) `mit` license file to the current working directory.

**Example**

```sh
$ gen license:mit
$ gen license:mit --dest ./foo
```

#### [ms-pl](generators/tasks.js#L337)

Generate a(n) `ms-pl` license file to the current working directory.

**Example**

```sh
$ gen license:ms-pl
$ gen license:ms-pl --dest ./foo
```

#### [ms-rl](generators/tasks.js#L353)

Generate a(n) `ms-rl` license file to the current working directory.

**Example**

```sh
$ gen license:ms-rl
$ gen license:ms-rl --dest ./foo
```

#### [mpl-2.0](generators/tasks.js#L369)

Generate a(n) `mpl-2.0` license file to the current working directory.

**Example**

```sh
$ gen license:mpl-2.0
$ gen license:mpl-2.0 --dest ./foo
```

#### [osl-3.0](generators/tasks.js#L385)

Generate a(n) `osl-3.0` license file to the current working directory.

**Example**

```sh
$ gen license:osl-3.0
$ gen license:osl-3.0 --dest ./foo
```

#### [ofl-1.1](generators/tasks.js#L401)

Generate a(n) `ofl-1.1` license file to the current working directory.

**Example**

```sh
$ gen license:ofl-1.1
$ gen license:ofl-1.1 --dest ./foo
```

#### [unlicense](generators/tasks.js#L417)

Generate a(n) `unlicense` license file to the current working directory.

**Example**

```sh
$ gen license:unlicense
$ gen license:unlicense --dest ./foo
```

#### [zlib](generators/tasks.js#L433)

Generate a(n) `zlib` license file to the current working directory.

**Example**

```sh
$ gen license:zlib
$ gen license:zlib --dest ./foo
```

## Next steps

### Running unit tests

It's never too early to begin running unit tests. When you're ready to get started, the following command will ensure the project's dependencies are installed then run all of the unit tests:

```sh
$ npm install && test
```

### Publishing your generator

If you're tests are passing and you're ready to publish your generator to [npm](https://www.npmjs.com), you can do that now with the following command:

**Are you sure you're ready?!**

Let's go!

```sh
$ npm publish
```

## About

### Related projects

* [generate-eslint](https://www.npmjs.com/package/generate-eslint): Generate a new `.eslintrc.json` or `.eslintignore` file from a pre-defined or user-defined template. Can be… [more](https://github.com/generate/generate-eslint) | [homepage](https://github.com/generate/generate-eslint "Generate a new `.eslintrc.json` or `.eslintignore` file from a pre-defined or user-defined template. Can be used from the command line when installed globally, or as a plugin in your own generator.")
* [generate-install](https://www.npmjs.com/package/generate-install): Generator that automatically detects the dependencies or devDependencies to install based on the templates or… [more](https://github.com/generate/generate-install) | [homepage](https://github.com/generate/generate-install "Generator that automatically detects the dependencies or devDependencies to install based on the templates or includes that are dynamically used by your generator. This can be used as a sub-generator or plugin in your own generator.")
* [generate-package](https://www.npmjs.com/package/generate-package): Generate a package.json from a pre-defined or user-defined template. This generator can be used from… [more](https://github.com/generate/generate-package) | [homepage](https://github.com/generate/generate-package "Generate a package.json from a pre-defined or user-defined template. This generator can be used from the command line when globally installed, or as a plugin or sub-generator in your own generator.")

### Community

Are you using [Generate](https://github.com/generate/generate) in your project? Have you published a [generator](https://github.com/generate/generate/blob/master/docs/generators.md) and want to share your project with the world?

Here are some suggestions!

* If you get like Generate and want to tweet about it, please feel free to mention `@generatejs` or use the `#generatejs` hashtag
* Show your love by starring [Generate](https://github.com/generate/generate) and `generate-license`
* Get implementation help on [StackOverflow](http://stackoverflow.com/questions/tagged/generate) (please use the `generatejs` tag in questions)
* **Gitter** Discuss Generate with us on [Gitter](https://gitter.im/generate/generate)
* If you publish an generator, thank you! To make your project as discoverable as possible, please add the keyword `generategenerator` to package.json.

### Contributors

| **Commits** | **Contributor**<br/> | 
| --- | --- |
| 73 | [jonschlinkert](https://github.com/jonschlinkert) |
| 10 | [pointnet](https://github.com/pointnet) |
| 2 | [doowb](https://github.com/doowb) |

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Running tests

Install dev dependencies:

```sh
$ npm install -d && npm test
```

## Release history

This project follows [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog) conventions for tracking release history.

### key

Changelog entries are categorized using the following labels:

* `added`: for new features
* `changed`: for changes in existing functionality
* `deprecated`: for once-stable features removed in upcoming releases
* `removed`: for deprecated features removed in this release
* `fixed`: for any bug fixes

### [0.5.0](https://github.com/generate/generate/compare/0.4.0...0.5.0)

**Added**

* Adds support for all `LICENSE` templates from [https://github.com/github/choosealicense.com](https://github.com/github/choosealicense.com)

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

### License

Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/generate/generate-license/blob/master/LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 01, 2016._