Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

licenses

crates.io GitHub Actions Workflow Status MIT

Cargo subcommand for collecting licenses.

Install

$ cargo install licenses

Usage

$ cargo licenses --help
Usage: cargo licenses [OPTIONS] <COMMAND>

Commands:
  collect  Collects all licenses into a folder
  summary  Provides a summary of all licenses

Options:
  -d, --dev                  Include dev dependencies [default: excluded]
  -b, --build                Include build dependencies [default: excluded]
  -D, --depth <DEPTH>        The depth of dependencies to include [default: all sub dependencies]
  -e, --exclude <WORKSPACE>  Exclude specified workspace [default: all included]
  -i, --ignore <CRATE>       Ignore specified crate [default: all included]
  -h, --help                 Print help

Examples

Collect

$ cargo licenses collect --depth 1
licenses
├── anyhow-LICENSE-APACHE
├── anyhow-LICENSE-MIT
├── cargo_metadata-LICENSE-MIT
├── clap-LICENSE-APACHE
├── clap-LICENSE-MIT
├── colored-LICENSE
├── itertools-LICENSE-APACHE
├── itertools-LICENSE-MIT
├── serde_json-LICENSE-APACHE
└── serde_json-LICENSE-MIT

Summary

$ cargo licenses summary --depth 1
MIT: cargo_metadata
MIT OR Apache-2.0: anyhow,clap,itertools,serde_json
MPL-2.0: colored
$ cargo licenses summary --depth 1 --json
{
  "MPL-2.0": [
    "colored"
  ],
  "MIT": [
    "cargo_metadata"
  ],
  "MIT OR Apache-2.0": [
    "anyhow",
    "clap",
    "itertools",
    "serde_json"
  ]
}