From 343a79a03497e6a12f9e0c117d09b7e0f5009f48 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 14 Oct 2014 00:49:02 -0400 Subject: [PATCH] CLI - Implemented ::categorize. --- src/CLI.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/CLI.cpp b/src/CLI.cpp index 449c25f0a..ac99092ca 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -141,6 +141,37 @@ void CLI::aliasExpansion () dump ("CLI::aliasExpansion"); } +//////////////////////////////////////////////////////////////////////////////// +void CLI::categorize () +{ + bool foundCommand = false; + + _filter.clear (); + _modifications.clear (); + _command = ""; + _readOnly = false; + + std::vector ::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. bool CLI::exactMatch (