jpeddicord / askalono

A tool & library to detect open source licenses from texts
Apache License 2.0
256 stars 25 forks source link

Think about API #18

Closed jpeddicord closed 6 years ago

jpeddicord commented 6 years ago

If you look at generated docs of the public API (while ignoring the lack of documentation) you'll note that while there is an API, it's not very complete and in some cases is a little inconsistent.

I've filed this issue to plan out what the API should look like long-term, starting with a 0.2 release.


See https://amzn.github.io/askalono/doc/askalono/ for the most up-to-date implementation.


Minimal usage:

  1. let store = Store::from_cache(File::open(filename)?);
  2. let out = store.analyze("some string of license text") - since analyze is Into<TextData> and TextData has From<&str>
  3. println!("it's {} with score {}", out.data.name(), out.score);

My current reservations:

jpeddicord commented 6 years ago

Going to have a go at implementing this today to see how it feels. No major changes needed behind the scenes, just moving some parts around.

jpeddicord commented 6 years ago

Merging these changes now; won't release 0.2 until I'm sure about it all though.

Stuck docs on https://amzn.github.io/askalono/doc/askalono/ of how this currently looks.

jpeddicord commented 6 years ago

Things feel "nice" with this API so far. Closing this issue.