mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-23 23:46:42 +02:00
TW-1300
- TW-1300 _get could use return codes (thanks to Scott Kostyshak).
This commit is contained in:
parent
32272addd0
commit
501194abfa
6 changed files with 107 additions and 5 deletions
|
@ -157,9 +157,9 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||
std::string canonical;
|
||||
|
||||
// <attr>
|
||||
if (name == "id") return format (task.id);
|
||||
else if (name == "urgency") return format (task.urgency_c ());
|
||||
else if (A3::is_attribute (name, canonical)) return task.get (canonical);
|
||||
if (task.size () && name == "id") return format (task.id);
|
||||
else if (task.size () && name == "urgency") return format (task.urgency_c ());
|
||||
else if (task.size () && A3::is_attribute (name, canonical)) return task.get (canonical);
|
||||
|
||||
// <id>.<name>
|
||||
if (n.getInt (id))
|
||||
|
|
|
@ -52,17 +52,23 @@ int CmdGet::execute (std::string& output)
|
|||
if (words.size () == 0)
|
||||
throw std::string (STRING_CMD_GET_NO_DOM);
|
||||
|
||||
bool found = false;
|
||||
std::vector <std::string> results;
|
||||
std::vector <std::string>::iterator word;
|
||||
for (word = words.begin (); word != words.end (); ++word)
|
||||
{
|
||||
Task t;
|
||||
results.push_back (context.dom.get (*word, t));
|
||||
std::string result = context.dom.get (*word, t);
|
||||
results.push_back (result);
|
||||
|
||||
if (result != "" &&
|
||||
result != *word)
|
||||
found = true;
|
||||
}
|
||||
|
||||
join (output, " ", results);
|
||||
output += "\n";
|
||||
return 0;
|
||||
return found ? 0 : 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue