CLI: Cleaned up and documented context filter code.

This commit is contained in:
Paul Beckingham 2015-06-07 09:52:58 -04:00
parent 490742284b
commit 7f763aacb9

View file

@ -357,6 +357,8 @@ void CLI::add (const std::string& arg)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// There are situations where a context filter is applied. This method
// determines whether one applies, and if so, applies it.
void CLI::addContextFilter () void CLI::addContextFilter ()
{ {
// Detect if any context is set, and bail out if not // Detect if any context is set, and bail out if not
@ -368,8 +370,6 @@ void CLI::addContextFilter ()
} }
// Detect if UUID or ID is set, and bail out // Detect if UUID or ID is set, and bail out
if (_args.size ())
{
for (auto& a : _args) for (auto& a : _args)
{ {
// TODO This looks wrong. // TODO This looks wrong.
@ -383,7 +383,6 @@ void CLI::addContextFilter ()
return; return;
} }
} }
}
// Apply context // Apply context
context.debug ("Applying context: " + contextName); context.debug ("Applying context: " + contextName);
@ -495,6 +494,8 @@ void CLI::analyze (bool parse /* = true */, bool strict /* = false */)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Scan arguments, looking for any tagged CONFIG, in which case extract the name
// and value, applying it to context.config.
void CLI::applyOverrides () void CLI::applyOverrides ()
{ {
for (auto& a : _args) for (auto& a : _args)