Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use spdx crate to verify and render spdx expressions #30

Closed
2 tasks done
ekkolon opened this issue Feb 3, 2024 · 0 comments · Fixed by #32
Closed
2 tasks done

feat: use spdx crate to verify and render spdx expressions #30

ekkolon opened this issue Feb 3, 2024 · 0 comments · Fixed by #32

Comments

@ekkolon
Copy link
Owner

ekkolon commented Feb 3, 2024

Description

Right now, we are only handling license IDs from the choosealicense repository, yet we could use the spdx crate for that. Additionally, the approach used right now isn't robust and fails validation even though license expressions provided by the user are valid SPDX expressions.

For example, executing the following command fails:

licensa apply --type "MIT or Apache-2.0"

We should allow the user to provide 'imprecise' license ids, since the spdx crate provides a nice function to infer valid SPDX ids from them.

In cases where the user supplies an imprecise license ID for which one or more valid SPDX ids can be inferred, we should prompt the user to select and confirm the valid license id.

This could look like this:

licensa apply --type "BSD"
...

# Select and confirm license id 

Which kind of BSD license would you like to use?:

- BSD-1-Clause
- BSD-2-Clause
- BSD-3-Clause
...etc

Tasks

  • Add function that takes as input a string and returns a result containing the list of inferred license ids. An error indicates that the provided id is invalid
  • Add prompt functionality using the inquirer crate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant