CLI
- Implemented ::isPattern, and used it.
This commit is contained in:
33
src/CLI.cpp
33
src/CLI.cpp
@@ -480,18 +480,14 @@ const std::string CLI::dump () const
|
|||||||
// 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)
|
||||||
{
|
{
|
||||||
// Do not lex RC overrides.
|
// Do not lex RC overrides, UUIDs, patterns.
|
||||||
if (isRCOverride (arg))
|
if (isRCOverride (arg) ||
|
||||||
_original_args.push_back (arg);
|
isConfigOverride (arg) ||
|
||||||
|
isUUID (arg) ||
|
||||||
if (isConfigOverride (arg))
|
isPattern (arg))
|
||||||
_original_args.push_back (arg);
|
{
|
||||||
|
|
||||||
// Do not lex patterns or single substitutions.
|
|
||||||
else if (arg.length () > 2 &&
|
|
||||||
arg[0] == '/' &&
|
|
||||||
arg[arg.length () - 1] == '/')
|
|
||||||
_original_args.push_back (arg);
|
_original_args.push_back (arg);
|
||||||
|
}
|
||||||
|
|
||||||
// Do not lex substitutions.
|
// Do not lex substitutions.
|
||||||
else if (arg.length () > 2 &&
|
else if (arg.length () > 2 &&
|
||||||
@@ -500,10 +496,6 @@ void CLI::addArg (const std::string& arg)
|
|||||||
arg[arg.length () - 1] == 'g')
|
arg[arg.length () - 1] == 'g')
|
||||||
_original_args.push_back (arg);
|
_original_args.push_back (arg);
|
||||||
|
|
||||||
// Do not lex UUIDs.
|
|
||||||
else if (isUUID (arg))
|
|
||||||
_original_args.push_back (arg);
|
|
||||||
|
|
||||||
// Do not lex, unless lexing reveals OPs.
|
// Do not lex, unless lexing reveals OPs.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1730,3 +1722,14 @@ bool CLI::isUUID (const std::string& raw) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
bool CLI::isPattern (const std::string& raw) const
|
||||||
|
{
|
||||||
|
if (raw.length () > 2 &&
|
||||||
|
raw[0] == '/' &&
|
||||||
|
raw[raw.length () - 1] == '/')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ private:
|
|||||||
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 isUUID (const std::string&) const;
|
bool isUUID (const std::string&) const;
|
||||||
|
bool isPattern (const std::string&) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::multimap <std::string, std::string> _entities;
|
std::multimap <std::string, std::string> _entities;
|
||||||
|
|||||||
Reference in New Issue
Block a user