projinfo as library function #4646
Open
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.
The main purpose if this PR is to allow the usage of
projinfoas a library, not only as a CLI program.That allows to call it, for instance, in the browser. See an example at https://jjimenezshaw.github.io/wasm-proj/projinfo.html
The code from the CLI was kept unmodified. To replicate the usage of std::cout and std::cerr, streams are used internally in the library, and the API is using a callback to report every call to those streams. See that some commands, like
--list-crscan be very fragmented, with many calls to the callback.For the specific usage of the callback in emscripten, a nicer helper in C++ is added to the
build_wasm.shscript. That makes the usage from javascript much simpler and small.I was not sure about the file structure to be used, and how to do it in CMake. Please, make any suggestion on that regard.
AI/LLM (Copilot, ChatGPT, Claude or something similar) supported my development of this PRCloses #xxxxdocs/source/*.rstfor new API: Where and what exactly?