mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CLI
- Implemented ::isUUIDList.
This commit is contained in:
parent
4dd953bf44
commit
fe2ea795ee
2 changed files with 31 additions and 5 deletions
35
src/CLI.cpp
35
src/CLI.cpp
|
@ -481,11 +481,12 @@ const std::string CLI::dump () const
|
||||||
void CLI::addArg (const std::string& arg)
|
void CLI::addArg (const std::string& arg)
|
||||||
{
|
{
|
||||||
// Do not lex RC overrides, UUIDs, patterns, substitutions.
|
// Do not lex RC overrides, UUIDs, patterns, substitutions.
|
||||||
if (isRCOverride (arg) ||
|
if (isRCOverride (arg) ||
|
||||||
isConfigOverride (arg) ||
|
isConfigOverride (arg) ||
|
||||||
isUUID (arg) ||
|
isUUIDList (arg) ||
|
||||||
isPattern (arg) ||
|
isUUID (arg) ||
|
||||||
isSubstitution (arg))
|
isPattern (arg) ||
|
||||||
|
isSubstitution (arg))
|
||||||
{
|
{
|
||||||
_original_args.push_back (arg);
|
_original_args.push_back (arg);
|
||||||
}
|
}
|
||||||
|
@ -1701,10 +1702,34 @@ bool CLI::isConfigOverride (const std::string& raw) const
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool CLI::isUUID (const std::string& raw) const
|
bool CLI::isUUIDList (const std::string& raw) const
|
||||||
{
|
{
|
||||||
// UUIDs have a limited character set.
|
// UUIDs have a limited character set.
|
||||||
if (raw.find_first_not_of ("0123456789abcdefABCDEF-,") == std::string::npos)
|
if (raw.find_first_not_of ("0123456789abcdefABCDEF-,") == std::string::npos)
|
||||||
|
{
|
||||||
|
Nibbler n (raw);
|
||||||
|
std::string token;
|
||||||
|
if (n.getUUID (token) ||
|
||||||
|
n.getPartialUUID (token))
|
||||||
|
{
|
||||||
|
while (n.skip (','))
|
||||||
|
if (! n.getUUID (token) &&
|
||||||
|
! n.getPartialUUID (token))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (n.depleted ())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
bool CLI::isUUID (const std::string& raw) const
|
||||||
|
{
|
||||||
|
// UUIDs have a limited character set.
|
||||||
|
if (raw.find_first_not_of ("0123456789abcdefABCDEF-") == std::string::npos)
|
||||||
{
|
{
|
||||||
Nibbler n (raw);
|
Nibbler n (raw);
|
||||||
std::string token;
|
std::string token;
|
||||||
|
|
|
@ -100,6 +100,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 isUUIDList (const std::string&) const;
|
||||||
bool isUUID (const std::string&) const;
|
bool isUUID (const std::string&) const;
|
||||||
bool isPattern (const std::string&) const;
|
bool isPattern (const std::string&) const;
|
||||||
bool isSubstitution (const std::string&) const;
|
bool isSubstitution (const std::string&) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue