mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
A3t::findUUIDList
- Added support for UUID lists. - Extended test script.
This commit is contained in:
parent
ed085bd09e
commit
8fddf97c73
3 changed files with 51 additions and 1 deletions
|
@ -69,6 +69,7 @@ Tree* A3t::parse ()
|
|||
findTag ();
|
||||
findAttribute ();
|
||||
findAttributeModifier ();
|
||||
findUUIDList (); // Before findIdSequence
|
||||
findIdSequence ();
|
||||
|
||||
validate ();
|
||||
|
@ -562,6 +563,54 @@ void A3t::findIdSequence ()
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void A3t::findUUIDList ()
|
||||
{
|
||||
std::vector <Tree*>::iterator i;
|
||||
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
||||
{
|
||||
// Parser override operator.
|
||||
if ((*i)->attribute ("raw") == "--")
|
||||
break;
|
||||
|
||||
// Skip known args.
|
||||
if (! (*i)->hasTag ("?"))
|
||||
continue;
|
||||
|
||||
std::string raw = (*i)->attribute ("raw");
|
||||
Nibbler n (raw);
|
||||
|
||||
std::vector <std::string> sequence;
|
||||
std::string uuid;
|
||||
if (n.getUUID (uuid) ||
|
||||
n.getPartialUUID (uuid))
|
||||
{
|
||||
sequence.push_back (uuid);
|
||||
|
||||
while (n.skip (','))
|
||||
{
|
||||
if (!n.getUUID (uuid) &&
|
||||
!n.getPartialUUID (uuid))
|
||||
throw std::string (STRING_A3_UUID_AFTER_COMMA);
|
||||
|
||||
sequence.push_back (uuid);
|
||||
}
|
||||
|
||||
if (!n.depleted ())
|
||||
throw std::string (STRING_A3_PATTERN_GARBAGE);
|
||||
|
||||
(*i)->unTag ("?");
|
||||
(*i)->tag ("UUID");
|
||||
std::vector <std::string>::iterator u;
|
||||
for (u = sequence.begin (); u != sequence.end (); ++u)
|
||||
{
|
||||
Tree* branch = (*i)->addBranch (new Tree ("list"));
|
||||
branch->attribute ("value", *u);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Validate the parse tree.
|
||||
void A3t::validate ()
|
||||
|
|
|
@ -52,6 +52,7 @@ private:
|
|||
void findAttribute ();
|
||||
void findAttributeModifier ();
|
||||
void findIdSequence ();
|
||||
void findUUIDList ();
|
||||
void validate ();
|
||||
|
||||
private:
|
||||
|
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
echo; ./args rc:~/.taskrc 123-128,140 142 mod pro:'P 1' +home /from/to/g /from/to/ rc.name=value
|
||||
echo; ./args rc:~/..taskrc rc.name=value add -- modify +tag /from/to/g name:value /long/path/to/file.txt
|
||||
echo; ./args /pattern/ limit:10 due.before:eom nex
|
||||
echo; ./args /pattern/ or 8ad2e3db-914d-4832-b0e6-72fa04f6e331 limit:10 due.before:eom nex
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue