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
gh extension install Shresht7/gh-license
💻 Usage
Invoke the cli extension like so:
gh license <command>
For example, to generate a license file:
gh license create mit
⌨️ Commands
create
Create a license file
Alias
new
, add
, init
, set
Usage
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
gh-license create mit
gh-license create mit --author Shresht7 --year 2023
gh-license create --web
gh-license create mit --web
list
Show a list of licenses
Usage
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
gh-license list
gh-license list --json
gh-license list --pretty-json
repo
View license of a repository
Alias
r
Usage
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
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
view
View details about a particular license
Alias
show
, get
Usage
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
gh-license view mit
gh-license view mit --json
gh-license view mit --pretty-json
📜 License
This software is licensed under the MIT License. See the LICENSE file for details.