github-license-fetcher

command module
v0.0.0-...-0438bb4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 18 Imported by: 0

README

Github License Fetcher

Github License Fetcher is a small CLI to retrieve licenses and other few metadata from github repositories based on the repository URL and version (tag or commit hash). Licenses will be retrieved at the specific version and downloaded in the current directory.

Usage

The CLI can run in 2 modes: single use or "batch".

Single use

Run with either a repository URL and a version:

$ ./github-license-getter -r https://github.com/${OWNER}/${REPOSITORY}/ -t ${VERSION}

It will print the package metadata and license if found.

Batch

Batch mode read a json file, consisting of an array of type PackageSummary (fields repository and version are mandatory):

$ ./github-license-getter -f ${FILE}

Packages parameters will be updated and a new file will be written with the datetime appended in the current directory.

Note: be careful of github rate limiting. Use the -d flag to specify a higher delay between 2 packages processing if needed. If a rate limit error has been raised, no more processing will be done.

Download licenses only

Combined with batch mode above, it will only download license files where there is a licenseURL, but the corresponding licenseTxt is missing. This works for all repositories, github and others as long as the URL is valid.

$ ./github-license-getter -f ${FILE} -l

Packages license texts will be updated and a new file will be written with the datetime appended in the current directory.

Note: URLs for github.com are automatically replaced with raw.githubusercontent.com.

Authentication

A Github Token can be used, by setting it in the GITHUB_TOKEN variable name.

Build

Just run go build to build the binary.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL