-
-
Notifications
You must be signed in to change notification settings - Fork 475
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
Use CLI11 command line parser library #2115
Merged
Merged
Conversation
This file contains 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
This switches parsing of command line arguments from getopt to the CLI11 library. Its adds CLI11 as a new dependency. With this commit CLI11 is vendored in in the contrib directory, because it is not available in Ubuntu 20.04 and Debian before Bookworm. It is available in Ubuntu 22.04 und Debian Bookworm and it is available in Homebrew and as vcpkg. So a bit down the line we can switch to the versions available from the OS distribution. For Windows we don't need the getopt version from alex85k any more and this commit also removes that code from the Github action setup. This commit is quite large, because we have to change everything at the same time. Changes are for osm2pgsql and osm2pgsql-gen which now share part of the option parsing code (database and logging options), in the new src/command-line-app.[ch]pp files. The code tries to keep the functionality the same as much as possible. So no extra checks on command line options or so, these can come later. There are some unavoidable changes: * Some error messages have changed * Help output is now generated by the CLI11 library so it looks very different. There is no verbose help version any more. All command line options are shown with --help, but some with a bit less detail than before. But all the detail is in the man page anyway. * CLI11 can not parse an empty option parameter, so something like "--foo=" does not work, it tries to use the next option as value for the option. This is not very relevant in the real world, but there might be some corner cases where this changes behaviour. See osm2pgsql-dev#142
Here is the output of
And this is the output of
|
Huge 👍 to moving from getopt to something that handles more of the work for us. |
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.
This switches parsing of command line arguments from getopt to the CLI11 library.
Its adds CLI11 as a new dependency. With this commit CLI11 is vendored in in the contrib directory, because it is not available in Ubuntu 20.04 and Debian before Bookworm. It is available in Ubuntu 22.04 und Debian Bookworm and it is available in Homebrew and as vcpkg. So a bit down the line we can switch to the versions available from the OS distribution.
For Windows we don't need the getopt version from alex85k any more and this commit also removes that code from the Github action setup.
This commit is quite large, because we have to change everything at the same time. Changes are for osm2pgsql and osm2pgsql-gen which now share part of the option parsing code (database and logging options), in the new src/command-line-app.[ch]pp files.
The code tries to keep the functionality the same as much as possible. So no extra checks on command line options or so, these can come later.
There are some unavoidable changes:
See #142