- Updated ::getOverride to scan all args, display the debug feedback, and derive
  the home dir.
- Removed Parser::getOverrides calls from Context.
- Cleaned up dead code in Context::initialize.
This commit is contained in:
Paul Beckingham 2014-11-02 21:31:25 -05:00
parent d49222e8c7
commit 9799fcefed
3 changed files with 20 additions and 22 deletions

View file

@ -355,14 +355,28 @@ void CLI::analyze (bool parse /* = true */)
}
////////////////////////////////////////////////////////////////////////////////
const std::string CLI::getOverride ()
void CLI::getOverride (std::string& home, File& rc)
{
std::vector <A>::const_iterator a;
for (a = _args.begin (); a != _args.end (); ++a)
{
if (a->hasTag ("RC"))
return a->attribute ("file");
{
rc = File (a->attribute ("file"));
home = rc;
return "";
std::string::size_type last_slash = rc._data.rfind ("/");
if (last_slash != std::string::npos)
home = rc._data.substr (0, last_slash);
else
home = ".";
context.header (format (STRING_PARSER_ALTERNATE_RC, rc._data));
// Keep looping, because if there are multiple rc:file arguments, the last
// one should dominate.
}
}
}
////////////////////////////////////////////////////////////////////////////////