- Implemented ::applyOverrides.
- Calls ::applyOverrides from Context.
This commit is contained in:
Paul Beckingham 2014-11-02 22:12:48 -05:00
parent c8dfa8f7fd
commit 9c245f838a
3 changed files with 18 additions and 1 deletions

View file

@ -354,6 +354,22 @@ void CLI::analyze (bool parse /* = true */)
context.debug ("CLI::analyze end"); context.debug ("CLI::analyze end");
} }
////////////////////////////////////////////////////////////////////////////////
void CLI::applyOverrides ()
{
std::vector <A>::const_iterator a;
for (a = _args.begin (); a != _args.end (); ++a)
{
if (a->hasTag ("CONFIG"))
{
std::string name = a->attribute ("name");
std::string value = a->attribute ("value");
context.config.set (name, value);
context.footnote (format (STRING_PARSER_OVERRIDE_RC, name, value));
}
}
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CLI::getOverride (std::string& home, File& rc) void CLI::getOverride (std::string& home, File& rc)
{ {

View file

@ -71,6 +71,7 @@ public:
void initialize (int, const char**); void initialize (int, const char**);
void add (const std::string&); void add (const std::string&);
void analyze (bool parse = true); void analyze (bool parse = true);
void applyOverrides ();
void getOverride (std::string&, File&); void getOverride (std::string&, File&);
void getDataLocation (Path&); void getDataLocation (Path&);
const std::string getFilter (); const std::string getFilter ();

View file

@ -177,7 +177,7 @@ int Context::initialize (int argc, const char** argv)
} }
// Create missing config file and data directory, if necessary. // Create missing config file and data directory, if necessary.
parser.applyOverrides (); cli.applyOverrides ();
// Setting the debug switch has ripple effects. // Setting the debug switch has ripple effects.
propagateDebug (); propagateDebug ();