Make the crate callable as a library #125
Merged
+1,220
−1,218
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change moves most of the functionality in main.rs to lib.rs and makes main() call it from there. The effect is that the functionality of this crate is available as a library crate as well as built into a binary.
Unfortunately, the github review UI does not make this super easy to review. I found it the easiest to review this by checking out the project twice and manually diff
main.rsfrom origin/main againstlib.rsin the head branch. Briefly, the change consists of updating the signature of run() to take args as an argument, and making relevant structs publicly visible.The reason why I'm looking for this change is that I'm working with some code to build the source files needed to create policy compliant sources files for deb packages for Ubuntu, and with this change I can pull in the vendor-filterer functionality without needing to have separate instructions on how to install the tool.
There are some usability changes that would be useful that I would be interested in contributing as follow-up PRs if you are interested in merging this change, moving the parsing of Cargo.toml config values out of the path of execution when using it as a library comes to mind, but I would not want to make this change bigger than it already is, and I would like to hear some about how you feel about landing this before I go through the work of making those changes