Bugzilla – Bug 2461
CommandLine should handle non-option arguments
Last modified: 2018-04-05 20:34:14 EDT
CommandLine only supports long-form flags: "--arg" and "--arg=x" It should also support nonoption (positional) arguments, which don't have the leading "--", and must occur in a specified order: $ foo arg1 --flag1 arg2 --flag2=x Suggest adding API: template <typename T> CommandLine::AddNonOption (std::string name, std::string help, T & value) The name string is used when printing the Usage message; the other args are as for AddValue. CommandLine would keep a vector of non-option arguments, and a counter of how many had been seen so far. It would probably be helpful to the user to query how many were seen: int CommandLine::GetNNonOption () (The term non-option is as used by the getopt() and getop_long() man pages.)
Pushed in r13466 (daa91474)