Open watkipet opened 3 years ago
Good point stating the possible attack vulerability. Again, as in #32 a short list of dependencies is desireable. Let's find a good compromise. 👍
I have not used any of these libs in particular but from an available documentation/feature set point of view, I think CLI11 is a good fit. I had also looked at argparse, but CI11 seemed to be a better fit
OK I'll investigate using CL11. CL11 is header-only. Unlike some other (even header-only) libraries, it's not in MacPorts, Ubuntu, or Debian's main package repos. I'll investigate how it's usually integrated with CMake.
@watkipet Since CMake v3.11, FetchContnet can be used to automatically download the repository as a dependency at configure time. This makes integrations pretty simple.
Example (untested)
include(FetchContent)
FetchContent_Declare(cl11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v2.1.1)
FetchContent_GetProperties(cl11)
if(NOT cl11_POPULATED)
FetchContent_Populate(cl11)
add_subdirectory(${cl11_SOURCE_DIR} ${cl11_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
The relevant code will end up in build/_deps/cl11-build , build/_deps/cl11-src , and build/_deps/cl11-subbuild
Initial work has been done, cli11 branch, CMake integration complete, and first pass in converting to CLI11 command-line parsing lib. I would welcome additional help
The present command-line parsing is difficult to understand and brittle. It's also subject to all sorts of buffer-overrun attacks (bad news for people putting a web interface in front of Splat! who don't sanitize their input). I suggest using a the 3rd party library for parsing command line arguments. The ones that seem reasonable (in order of what I think I'd prefer) are:
Any concerns about using the 3rd party library? Any preference for one of these (or another)?