From 0d682ee7a9cd0394814066aa49a0266e75629857 Mon Sep 17 00:00:00 2001 From: Paul Fenwick Date: Fri, 24 Nov 2017 01:45:39 -0500 Subject: [PATCH] Docs/CLI2: Additional dev docs for applyOverrides --- src/CLI2.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index ddf51e2e2..516bb9504 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -277,16 +277,23 @@ void CLI2::applyOverrides (int argc, const char** argv) { for (int i = 0; i < argc; ++i) { + + // Don't process any arguments after a '--' std::string raw = argv[i]; if (raw == "--") break; + // Overrides always start with 'rc.' if (raw.length () > 3 && raw.substr (0, 3) == "rc.") { + + // Our separator can either be '=' or ':', so try and find both. auto sep = raw.find ('=', 3); if (sep == std::string::npos) sep = raw.find (':', 3); + + // Process our override if well-formed if (sep != std::string::npos) { std::string name = raw.substr (3, sep - 3);