Open DanRStevens opened 5 years ago
I was looking at some command line processing code in other applications recently. Some dispense with the "/" for settings and simply go with "keyName=value" right on the command line. That would nicely match the INI file syntax.
Actually, we could potentially read setting from either the command line or the INI file for console modules. Perhaps check the INI file for the module name, and load settings from there as the defaults, and override them with anything specific from the command line.
In terms of processing the command line, we could use the same approach as the old INI file processing code, where we split on =
(if it exists) to extract the keyName
and value
. Alternatively we could use Regex capture groups. A possible Regex to use is ([^=]+)=(.*)
. Either way, if there was a match, we could store the resulting keyName
and value
pair into a std::map
for the most recent /loadmod
parameter.
In #205, a proposal was made to generalize back-end passing of key/value string settings to modules. This issue is concerned about the front-end syntax of how this might apply to console modules, and the internal data structures used to store that information.
I don't have a set vision on this, but rather an example of how it might be done. One possible syntax for passing console module specific settings is with extra options from the command line. Example:
The command line could be parsed, anything after the module name and before the next
/loadmod
option (if any) could be stored in a key/value string storage structure. One possibility for internal storage is astd::map
.The example above doesn't quite match current syntax. In Issue #184, there was mention of two options for specifying multiple modules. One option was to take multiple
/loadmod
options each with a single module name, and the other was to take a single/loadmod
option with potentially multiple arguments for the module name. The rather sensible choice (less code modification) made in PR #202 is the later, with a single/loadmod
and potentially multiple module names. I haven't really considered how to add console specific settings with a clear syntax for the later case, so desired syntax may need to be a point of discussion.