I am writing a new implementation of existing software (clean room implementation so no access to old code) and as well as a new command line interface I need to emulate the old interface for compatibility with existing workflows. I am choosing between old and new interface depending on the name with which the executable is invoked like e.g busybox.
The old command line interface essentially uses key value pairs but without any '-' or '=' characters. e.g
./oldcode Key1 value1 Key2 value2 Key3 value3 ...
I am already using boost so would like to stick with program_options if I can. The easiest thing would be to simply parse options without requiring and '--' at the beginning of the argument but I cannot see a way to do this.
Is this feasible with program_options or would I be better off writing a custom parser for this?
You have to write a custom parser for it, it is not that hard :) Especially, when you what you find.
The boost mechanism excepted the = sing for key,value pairs.
If you do not want to write it own, use the the existing code: https://github.com/jarro2783/cxxopts