getLicenseFromSpdxId
lib.getLicenseFromSpdxId
Docs pulled from | This Revision | about 3 hours ago
Get the corresponding attribute in lib.licenses from the SPDX ID
or warn and fallback to { shortName = <license string>; }
.
For SPDX IDs, see https://spdx.org/licenses. Note that some SPDX licenses might be missing.
Type
getLicenseFromSpdxId :: str -> AttrSet
Examples
lib.meta.getLicenseFromSpdxId
usage example
lib.getLicenseFromSpdxId "MIT" == lib.licenses.mit
=> true
lib.getLicenseFromSpdxId "mIt" == lib.licenses.mit
=> true
lib.getLicenseFromSpdxId "MY LICENSE"
=> trace: warning: getLicenseFromSpdxId: No license matches the given SPDX ID: MY LICENSE
=> { shortName = "MY LICENSE"; }
Noogle detected
Implementation
The following is the current implementation of this function.
getLicenseFromSpdxId =
licstr:
getLicenseFromSpdxIdOr licstr (
lib.warn "getLicenseFromSpdxId: No license matches the given SPDX ID: ${licstr}"
{ shortName = licstr; }
);