Skip to content
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 a command-line parsing library #33

Open
watkipet opened this issue Dec 14, 2020 · 5 comments
Open

Use a command-line parsing library #33

watkipet opened this issue Dec 14, 2020 · 5 comments
Assignees

Comments

@watkipet
Copy link
Collaborator

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:

  1. CLI11
  2. gflags
  3. tclap

Any concerns about using the 3rd party library? Any preference for one of these (or another)?

@der-stefan
Copy link
Collaborator

Good point stating the possible attack vulerability. Again, as in #32 a short list of dependencies is desireable. Let's find a good compromise. 👍

@dBitech
Copy link
Collaborator

dBitech commented Dec 15, 2020

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

@watkipet
Copy link
Collaborator Author

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.

@VA7DBI
Copy link

VA7DBI commented Oct 6, 2021

@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

@dBitech
Copy link
Collaborator

dBitech commented Oct 10, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants