hoche / splat

SPLAT! is an RF Signal Propagation, Loss, And Terrain analysis tool for the spectrum between 20 MHz and 20 GHz. This is a copy of the code written by John Magliacane, heavily modified to clean up the code and take advantage of multithreading. This incorporates John's antenna height modifications from the as-yet-unreleased SPLAT 1.4.3.
http://www.qsl.net/kd2bd/splat.html
GNU General Public License v2.0
27 stars 6 forks source link

Use a command-line parsing library #33

Open watkipet opened 3 years ago

watkipet commented 3 years ago

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 commented 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. 👍

dBitech commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

@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 commented 2 years ago

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