-
Notifications
You must be signed in to change notification settings - Fork 868
projinfo as library function #4646
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
Open
jjimenezshaw
wants to merge
13
commits into
OSGeo:master
Choose a base branch
from
jjimenezshaw:projinfo-lib
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+2,524
−2,113
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jjimenezshaw
commented
Dec 30, 2025
| #endif | ||
| return 0; | ||
| } else if (arg == "-?" || arg == "--help") { | ||
| return usage(strm); |
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in master is considering --help an error, and returns 1 (probably because it was simpler)
I kept the same behaviour in the code, but it is easy to change with this.
Suggested change
| return usage(strm); | |
| usage(strm); | |
| return 0; |
Should I do it?
Contributor
Author
|
cc @willcohen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?