[program options] Is it possible to add new options during parsing?
Hi, I am wondering if it is possible (and if so, what is the best way) to add new options to a parser during parsing, that is, during the call to run(). The use case scenario is that I have an option called 'type' and if the type specified at runtime equals 'string1' I want to allow and parse a set of extra options (which -of course- can only be specified after type), and if it equals 'string2' then I want to allow and parse a different set of extra options. To do this I am thinking of using a command_line_parser and invoking extra_parser() with a function that will invoke method options() on the command_line_parser object as appropriate. I am wondering if adding options during parsing is going to break something or if there is a cleaner way to achieve this. One of the reasons why I don't like this solution so much is the need to pass somehow the parser object to the funcion that does the extra parsing, although I think I can use bind for that. Thank you. Regards, Jorge
participants (1)
-
Jorge Moraleda