On Wednesday, 26 February 2014 at 09:57:19 UTC, Andrew Edwards wrote:
Request a small example of how to use getopt to accomplish the following:

[1] program subcommand //process subcommand with default arguments if any [2] program -h subcommand //output help information about subcommand [3] program subcommand --option1 --option2 true option3=log.txt // process subcommand with user specified options

Thanks,
Andrew

This is not fully automated with getopt. You could use getopt to parse all non-positional arguments and than parse the rest by hand.
--
getopt(args, ...);
--
Now, args[1] (or [0]?) should be "subcommand".

Reply via email to