CLI
- Implemented ::categorize.
This commit is contained in:
31
src/CLI.cpp
31
src/CLI.cpp
@@ -141,6 +141,37 @@ void CLI::aliasExpansion ()
|
|||||||
dump ("CLI::aliasExpansion");
|
dump ("CLI::aliasExpansion");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CLI::categorize ()
|
||||||
|
{
|
||||||
|
bool foundCommand = false;
|
||||||
|
|
||||||
|
_filter.clear ();
|
||||||
|
_modifications.clear ();
|
||||||
|
_command = "";
|
||||||
|
_readOnly = false;
|
||||||
|
|
||||||
|
std::vector <std::string>::iterator i;
|
||||||
|
for (i = _args.begin (); i != _args.end (); ++i)
|
||||||
|
{
|
||||||
|
if (canonicalize (_command, "cmd", *i))
|
||||||
|
{
|
||||||
|
foundCommand = true;
|
||||||
|
_readOnly = ! exactMatch ("writecmd", _command);
|
||||||
|
}
|
||||||
|
else if (foundCommand && ! _readOnly)
|
||||||
|
{
|
||||||
|
_modifications.push_back (*i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_filter.push_back (*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dump ("CLI::categorize");
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Search for exact 'value' in _entities category.
|
// Search for exact 'value' in _entities category.
|
||||||
bool CLI::exactMatch (
|
bool CLI::exactMatch (
|
||||||
|
|||||||
Reference in New Issue
Block a user