Docs/CLI2: Additional dev docs for applyOverrides
This commit is contained in:
committed by
Paul Beckingham
parent
9d26327ae4
commit
aefe16a6e2
@@ -277,16 +277,23 @@ void CLI2::applyOverrides (int argc, const char** argv)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < argc; ++i)
|
for (int i = 0; i < argc; ++i)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Don't process any arguments after a '--'
|
||||||
std::string raw = argv[i];
|
std::string raw = argv[i];
|
||||||
if (raw == "--")
|
if (raw == "--")
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Overrides always start with 'rc.'
|
||||||
if (raw.length () > 3 &&
|
if (raw.length () > 3 &&
|
||||||
raw.substr (0, 3) == "rc.")
|
raw.substr (0, 3) == "rc.")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Our separator can either be '=' or ':', so try and find both.
|
||||||
auto sep = raw.find ('=', 3);
|
auto sep = raw.find ('=', 3);
|
||||||
if (sep == std::string::npos)
|
if (sep == std::string::npos)
|
||||||
sep = raw.find (':', 3);
|
sep = raw.find (':', 3);
|
||||||
|
|
||||||
|
// Process our override if well-formed
|
||||||
if (sep != std::string::npos)
|
if (sep != std::string::npos)
|
||||||
{
|
{
|
||||||
std::string name = raw.substr (3, sep - 3);
|
std::string name = raw.substr (3, sep - 3);
|
||||||
|
|||||||
Reference in New Issue
Block a user