mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI
- Implemented ::unsweetenPatterns.
This commit is contained in:
parent
932865d3b5
commit
8d359ddd70
2 changed files with 40 additions and 1 deletions
40
src/CLI.cpp
40
src/CLI.cpp
|
@ -294,7 +294,8 @@ const std::string CLI::getFilter ()
|
||||||
unsweetenTags ();
|
unsweetenTags ();
|
||||||
unsweetenAttributes ();
|
unsweetenAttributes ();
|
||||||
unsweetenAttributeModifiers ();
|
unsweetenAttributeModifiers ();
|
||||||
// TODO all the other types: pattern, id, uuid ...
|
unsweetenPatterns ();
|
||||||
|
// TODO all the other types: id, uuid ...
|
||||||
|
|
||||||
std::string filter = "";
|
std::string filter = "";
|
||||||
if (_args.size ())
|
if (_args.size ())
|
||||||
|
@ -801,6 +802,43 @@ void CLI::unsweetenAttributeModifiers ()
|
||||||
_args = reconstructed;
|
_args = reconstructed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// /pattern/ --> description ~ pattern
|
||||||
|
void CLI::unsweetenPatterns ()
|
||||||
|
{
|
||||||
|
std::vector <A> reconstructed;
|
||||||
|
std::vector <A>::iterator a;
|
||||||
|
for (a = _args.begin (); a != _args.end (); ++a)
|
||||||
|
{
|
||||||
|
Nibbler n (a->attribute ("raw"));
|
||||||
|
std::string pattern;
|
||||||
|
|
||||||
|
if (n.getQuoted ('/', pattern) &&
|
||||||
|
n.depleted () &&
|
||||||
|
pattern.length () > 0)
|
||||||
|
{
|
||||||
|
A lhs ("argPattern", "description");
|
||||||
|
lhs.tag ("ATT");
|
||||||
|
lhs.tag ("FILTER");
|
||||||
|
reconstructed.push_back (lhs);
|
||||||
|
|
||||||
|
A op ("argPattern", "~");
|
||||||
|
op.tag ("OP");
|
||||||
|
op.tag ("FILTER");
|
||||||
|
reconstructed.push_back (op);
|
||||||
|
|
||||||
|
A rhs ("argPattern", "'" + pattern + "'");
|
||||||
|
rhs.tag ("LITERAL");
|
||||||
|
rhs.tag ("FILTER");
|
||||||
|
reconstructed.push_back (rhs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
reconstructed.push_back (*a);
|
||||||
|
}
|
||||||
|
|
||||||
|
_args = reconstructed;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CLI::dump (const std::string& label) const
|
void CLI::dump (const std::string& label) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,6 +79,7 @@ private:
|
||||||
void unsweetenTags ();
|
void unsweetenTags ();
|
||||||
void unsweetenAttributes ();
|
void unsweetenAttributes ();
|
||||||
void unsweetenAttributeModifiers ();
|
void unsweetenAttributeModifiers ();
|
||||||
|
void unsweetenPatterns ();
|
||||||
void dump (const std::string&) const;
|
void dump (const std::string&) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue