[Tile-serving] [osm2pgsql-dev/osm2pgsql] Use CLI11 command line parser library (PR #2115)
Jochen Topf
notifications at github.com
Fri Dec 22 09:11:55 UTC 2023
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 #142
You can view, comment on, or merge this pull request online at:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2115
-- Commit Summary --
* Use CLI11 command line parser library
-- File Changes --
D .github/actions/win-getopt/action.yml (20)
M .github/workflows/ci.yml (3)
M CMakeLists.txt (17)
M README.md (1)
A contrib/CLI11/LICENSE (25)
A contrib/CLI11/README.contrib (2)
A contrib/CLI11/README.md (1828)
A contrib/CLI11/include/CLI/App.hpp (1399)
A contrib/CLI11/include/CLI/CLI.hpp (36)
A contrib/CLI11/include/CLI/Config.hpp (48)
A contrib/CLI11/include/CLI/ConfigFwd.hpp (185)
A contrib/CLI11/include/CLI/Error.hpp (354)
A contrib/CLI11/include/CLI/Formatter.hpp (25)
A contrib/CLI11/include/CLI/FormatterFwd.hpp (189)
A contrib/CLI11/include/CLI/Macros.hpp (75)
A contrib/CLI11/include/CLI/Option.hpp (807)
A contrib/CLI11/include/CLI/Split.hpp (48)
A contrib/CLI11/include/CLI/StringTools.hpp (234)
A contrib/CLI11/include/CLI/Timer.hpp (135)
A contrib/CLI11/include/CLI/TypeTools.hpp (1588)
A contrib/CLI11/include/CLI/Validators.hpp (916)
A contrib/CLI11/include/CLI/Version.hpp (16)
A contrib/CLI11/include/CLI/impl/App_inl.hpp (2105)
A contrib/CLI11/include/CLI/impl/Config_inl.hpp (395)
A contrib/CLI11/include/CLI/impl/Formatter_inl.hpp (291)
A contrib/CLI11/include/CLI/impl/Option_inl.hpp (653)
A contrib/CLI11/include/CLI/impl/Split_inl.hpp (139)
A contrib/CLI11/include/CLI/impl/StringTools_inl.hpp (260)
A contrib/CLI11/include/CLI/impl/Validators_inl.hpp (347)
M man/osm2pgsql-gen.md (8)
M src/CMakeLists.txt (1)
A src/command-line-app.cpp (112)
A src/command-line-app.hpp (42)
M src/command-line-parser.cpp (977)
M src/gen/osm2pgsql-gen.cpp (199)
M src/osm2pgsql.cpp (2)
M tests/bdd/regression/properties.feature (11)
M tests/test-options-parse.cpp (12)
-- Patch Links --
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2115.patch
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2115.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2115
You are receiving this because you are subscribed to this thread.
Message ID: <osm2pgsql-dev/osm2pgsql/pull/2115 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20231222/6b13eff9/attachment-0001.htm>
More information about the Tile-serving
mailing list