- Implemented ::isCommand.
This commit is contained in:
Paul Beckingham 2014-11-02 11:58:33 -05:00
parent 78625d00ec
commit 290f248db8
2 changed files with 10 additions and 1 deletions

View file

@ -511,12 +511,13 @@ const std::string CLI::dump (const std::string& title /* = "CLI Parser" */) cons
// be lexed from those that need to be left alone. // be lexed from those that need to be left alone.
// //
// Either the arg is appended to _original_args intact, or the lexemes are. // Either the arg is appended to _original_args intact, or the lexemes are.
void CLI::addArg (const std::string& arg) void CLI::addArg (const std::string& arg, bool first /* = false */)
{ {
// Do not lex these constructs. // Do not lex these constructs.
if (isTerminator (arg) || // -- if (isTerminator (arg) || // --
isRCOverride (arg) || // rc:<file> isRCOverride (arg) || // rc:<file>
isConfigOverride (arg) || // rc.<attr>:<value> isConfigOverride (arg) || // rc.<attr>:<value>
isCommand (arg) || // <cmd>
isTag (arg) || // [+-]<tag> isTag (arg) || // [+-]<tag>
isUUIDList (arg) || // <uuid>,[uuid ...] isUUIDList (arg) || // <uuid>,[uuid ...]
isUUID (arg) || // <uuid> isUUID (arg) || // <uuid>
@ -1877,6 +1878,13 @@ bool CLI::isConfigOverride (const std::string& raw) const
return false; return false;
} }
////////////////////////////////////////////////////////////////////////////////
bool CLI::isCommand (const std::string& raw) const
{
std::string canonical;
return canonicalize (canonical, "cmd", raw);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool CLI::isTag (const std::string& raw) const bool CLI::isTag (const std::string& raw) const
{ {

View file

@ -102,6 +102,7 @@ private:
bool isTerminator (const std::string&) const; bool isTerminator (const std::string&) const;
bool isRCOverride (const std::string&) const; bool isRCOverride (const std::string&) const;
bool isConfigOverride (const std::string&) const; bool isConfigOverride (const std::string&) const;
bool isCommand (const std::string&) const;
bool isTag (const std::string&) const; bool isTag (const std::string&) const;
bool isUUIDList (const std::string&) const; bool isUUIDList (const std::string&) const;
bool isUUID (const std::string&) const; bool isUUID (const std::string&) const;