I don't quite understand what to do if getopt throws. I would have hoped for something like

   int arg1;
   string arg2;
auto parser = getopt("opt1", "docstring 1", &arg1, "opt2", "docstring 2", &arg2);
   try {
     auto opts = parser.parse(args)
   }
   except(BadArguments) {
     parser.showHelpString();
   }

but instead, the docstring from getopt is only generated if all arguments are valid, i.e. when it's the least needed because the user already knew what to input.

What's the proper style, then? Can someone show me a good example of how to use getopt and the docstring it automatically generates?

Reply via email to