Hi,
Preslav, to manage command-line options we using PETSc interface. See, for example,
https://petsc.org/release/docs/manualpages/Sys/PetscOptionsBegin.html
PETSc interface is written on top of getopt. What could be useful from your perspective, is that when you write,
./prog -help
MOFEM/PETSc program will list you a list of the options. Now you can parse them. I imagine, that you can have some other tool, written in python, which will transform the output from -help about options into JSON and automatize input to FreeCAD.
Lukasz