mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
DOM
- Converted DOM and unit test from Parser to CLI.
This commit is contained in:
parent
efb84b20bf
commit
283a1aa8ef
2 changed files with 5 additions and 13 deletions
16
src/DOM.cpp
16
src/DOM.cpp
|
@ -109,16 +109,8 @@ bool DOM::get (const std::string& name, Variant& value)
|
|||
}
|
||||
else if (name == "context.args")
|
||||
{
|
||||
std::string commandLine = "";
|
||||
std::vector <Tree*>::iterator i;
|
||||
for (i = context.parser.tree ()->_branches.begin (); i != context.parser.tree ()->_branches.end (); ++i)
|
||||
{
|
||||
if (commandLine != "")
|
||||
commandLine += " ";
|
||||
|
||||
commandLine += (*i)->attribute ("raw");
|
||||
}
|
||||
|
||||
std::string commandLine;
|
||||
join (commandLine, " ", context.cli._original_args);
|
||||
value = Variant (commandLine);
|
||||
return true;
|
||||
}
|
||||
|
@ -243,7 +235,7 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value)
|
|||
if (elements.size () == 1)
|
||||
{
|
||||
std::string canonical;
|
||||
if (task.size () && context.parser.canonicalize (canonical, "attribute", name))
|
||||
if (task.size () && context.cli.canonicalize (canonical, "attribute", name))
|
||||
{
|
||||
Column* column = context.columns[canonical];
|
||||
if (column)
|
||||
|
@ -308,7 +300,7 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value)
|
|||
}
|
||||
|
||||
std::string canonical;
|
||||
if (context.parser.canonicalize (canonical, "attribute", elements[1]))
|
||||
if (context.cli.canonicalize (canonical, "attribute", elements[1]))
|
||||
{
|
||||
if (elements.size () == 2)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ int main (int argc, char** argv)
|
|||
{
|
||||
// Prime the pump.
|
||||
const char* fake_argv[] = {"task"};
|
||||
context.parser.initialize (1, fake_argv);
|
||||
context.cli.initialize (1, fake_argv);
|
||||
context.program = "task";
|
||||
context.config.set ("name", "value");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue