Crate lice

Source
Expand description

§lice

Build Status License Docs Latest Version rustc 1.65+

Dead simple, minimal SPDX License generator library written in Rust. Lice is in https://github.com/refcell/lice/labels/beta

Install | User Docs | Crate Docs | Reference | Contributing | License | Attribution

§What is lice?

lice is a dead simple, minimal library for generating valid SPDX licenses. It was primarily built for amble but ripped out into it’s own crate to provide an extensible library, published on crates.io.

§Usage

Install lice with cargo.

cargo add lice

A short example to query for the MIT License is shown below.

use anyhow::Result;

#[tokio::main]
async fn main() -> Result<()> {
    let license = lice::get("mit").await?;
    assert_eq!(license.license_id, "MIT");
    Ok(())    
}

Under the hood, the get function fetches licenses and fuzzy matches, using the first choice to query the license details, returning the merged License and its details.

§Contributing

All contributions are welcome! Experimentation is highly encouraged and new issues are welcome.

§Troubleshooting & Bug Reports

Please check existing issues for similar bugs or open an issue if no relevant issue already exists.

§Attribution

Much of this work is based off of lic, an spdx license generator binary that isn’t extensible as a library. The adapted lice crate extends the SPDX “API” to provide more verbose license fetching methods. Big h/t to the creators of lic especially SigureMo

§License

This project is licensed under the MIT License. Free and open-source, forever. All our rust are belong to you.

Re-exports§

pub use types::*;
pub use spdx::*;

Modules§

spdx
SPDX API client.
types
Core license types.

Functions§

get
Get fetches a license by ID, e.g. MIT. Internally, this is a wrapper around SPDX::license, performing a fuzzy search for the given ID, and merging the results with the full license details.