Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shresht7/gh-license

A GitHub CLI extension to view and generate license files 📄
https://github.com/shresht7/gh-license

cli gh-extension license

Last synced: 22 days ago
JSON representation

A GitHub CLI extension to view and generate license files 📄

Awesome Lists containing this project

README

        

# `gh-license`

A GitHub CLI extension to view and generate license files.

All license information is obtained from the GitHub API (https://docs.github.com/en/rest/licenses).

> **NOTE**: The only purpose the CLI serves, is to save you the effort of opening up a browser to copy-&-paste the appropriate LICENSE text. It does NOT provide legal advice and you should still double-check the LICENSE yourself for any errors.

---

## 📦 Installation

### Requirements

- [GitHub CLI](https://cli.github.com/)

```sh
gh extension install Shresht7/gh-license
```

---

## 💻 Usage

Invoke the cli extension like so:

```sh
gh license
```

For example, to generate a license file:

```sh
gh license create mit
```

![Usage Demonstration](docs/demo.gif)

[⬆️ Back to top][top]

## ⌨️ Commands

### `create`

Create a license file

#### Alias

`new`, `add`, `init`, `set`

#### Usage

```sh
gh-license create [flags]
```

#### Flags

| Flag | Type | Description | Default |
| ------------------- | -------- | ------------------------------------------- | ---------------- |
| `--author, -a` | `string` | Author of the project | [AuthorName] |
| `--description, -d` | `string` | Project description | |
| `--output, -o` | `string` | Filepath | LICENSE |
| `--project, -p` | `string` | Project name | [RepositoryName] |
| `--web, -w` | `bool` | Create license file using the web interface | false |
| `--year, -y` | `string` | Year | [CurrentYear] |

#### Examples

```sh
gh-license create mit
gh-license create mit --author Shresht7 --year 2023
gh-license create --web
gh-license create mit --web
```

[⬆️ Back to top][top]

### `list`

Show a list of licenses

#### Usage

```sh
gh-license list [flags]
```

#### Flags

| Flag | Type | Description | Default |
| ------------------- | ------ | ------------------------------- | ------- |
| `--json, -j` | `bool` | Output in JSON format | false |
| `--pretty-json, -p` | `bool` | Output in pretty JSON format | false |
| `--web, -w` | `bool` | Open the license in the browser | false |

#### Examples

```sh
gh-license list
gh-license list --json
gh-license list --pretty-json
```

[⬆️ Back to top][top]

### `repo`

View license of a repository

#### Alias

`r`

#### Usage

```sh
gh-license repo [flags]
```

#### Flags

| Flag | Type | Description | Default |
| ------------------- | ------ | --------------------------------------- | ------- |
| `--json, -j` | `bool` | Print the license in JSON format | false |
| `--pretty-json, -p` | `bool` | Print the license in pretty JSON format | false |
| `--web, -w` | `bool` | Open the license in the browser | false |

#### Examples

```sh
gh license repo
gh license repo Shresht7/gh-license
gh license repo gh-license
gh license repo --json
gh license repo Shresht7/gh-license --pretty-json
```

[⬆️ Back to top][top]

### `view`

View details about a particular license

#### Alias

`show`, `get`

#### Usage

```sh
gh-license view [flags]
```

#### Flags

| Flag | Type | Description | Default |
| ------------------- | ------ | ----------------------------------------------- | ------- |
| `--json, -j` | `bool` | Print the license details in JSON format | false |
| `--pretty-json, -p` | `bool` | Print the license details in pretty JSON format | false |
| `--web, -w` | `bool` | Open the license in the browser | false |

#### Examples

```sh
gh-license view mit
gh-license view mit --json
gh-license view mit --pretty-json
```

[⬆️ Back to top][top]

---

## 📜 License

This software is licensed under the [MIT License](). See the [LICENSE](./LICENSE) file for details.

[top]: #gh-license