I have a positional option (a file name), and I want it to be the very last option. The user can pass in a bunch of stuff on the command line, and also use -F
for the file name. However, I want the user also to have the ability to place the file name at the end.
For example:
./program --var 3 /path/to/file
The code I currently have implemented allows the caller to place the file name wherever in the command line. Is there any way to force the positional arguments to always come after the "regular" ones?
Here's how I set-up the positional argument:
pos_opts_desc.add("filename", -1);
And to parse the command line:
store(
command_line_parser(argc, argv).options(opts_desc).positional(pos_opts_desc).run(),
opts_var_map);
Thanks in advance for the help.
Edited to add:
I'm perfectly OK with -F
being specified anywhere in the command line. However, if the setting was done via the positional option, I want to ensure that the positional option is at the very end.