ICRAR / leap-accelerate

Low-frequency Excision of the Atmosphere in Parallel
GNU General Public License v2.0
1 stars 1 forks source link

Add Config File Parsing #67

Closed calgray closed 4 years ago

calgray commented 4 years ago

Andreas has mentioned that configuration needs to be done via a configuration file to avoid large scripts with string regex to call leap-accelerate-cli. Here I've added three stages of configuration/argument loading in preference (ordered from highest to lowest):

From this change I'll add unit tests around the new behaviour before adding output file support.

calgray commented 4 years ago

I was hoping the third layer isn't but it would mean I'd have do something like convert the parsed json into command line strings (CLIArguments) and moving the type conversions into ArgumentsValidated which isn't efficient and results in a larger constructor or ApplyArguments method.

The better approach is for CLI11 to support the typed Arguments struct via the use of lambdas. I suspect this could be possible via Option->transform() and maybe a templated helper but I haven't looked much into it.

calgray commented 4 years ago

CLI11 also has built in support for INI config files and JSON via the use of config_formatter demoed here: https://github.com/CLIUtils/CLI11/blob/master/examples/json.cpp

The same problem of supporting enums and MVDirections described above applies but would be nice to use.