From d5e6aa76404ddf3e82e8203a392bd7cbf58f9a5f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 27 Oct 2014 13:40:32 -0400 Subject: [PATCH] CLI - Implemented ::isConfigOverride, and used it. --- src/CLI.cpp | 20 +++++++++++++++----- src/CLI.h | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/CLI.cpp b/src/CLI.cpp index d508a3782..05f7ff5ff 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -477,9 +477,10 @@ const std::string CLI::dump () const void CLI::addArg (const std::string& arg) { // Do not lex RC overrides. - if (arg.length () > 3 && - (arg.substr (0, 3) == "rc." || - arg.substr (0, 3) == "rc:")) + if (isRCOverride (arg)) + _original_args.push_back (arg); + + if (isConfigOverride (arg)) _original_args.push_back (arg); // Do not lex patterns or single substitutions. @@ -601,12 +602,12 @@ void CLI::findOverrides () if (terminated) continue; - if (raw.find ("rc:") == 0) + if (isRCOverride (raw)) { a->tag ("RC"); a->attribute ("file", raw.substr (3)); } - else if (raw.find ("rc.") == 0) + else if (isConfigOverride (raw)) { std::string::size_type sep = raw.find ('=', 3); if (sep == std::string::npos) @@ -1700,6 +1701,15 @@ bool CLI::isRCOverride (const std::string& raw) const return false; } +//////////////////////////////////////////////////////////////////////////////// +bool CLI::isConfigOverride (const std::string& raw) const +{ + if (raw.length () > 3 && raw.substr (0, 3) == "rc.") + return true; + + return false; +} + //////////////////////////////////////////////////////////////////////////////// bool CLI::isUUID (const std::string& raw) const { diff --git a/src/CLI.h b/src/CLI.h index 070a97234..951aef40c 100644 --- a/src/CLI.h +++ b/src/CLI.h @@ -99,6 +99,7 @@ private: void decomposeModSubstitutions (); bool isRCOverride (const std::string&) const; + bool isConfigOverride (const std::string&) const; bool isUUID (const std::string&) const; public: