- TW-1300 _get could use return codes (thanks to Scott Kostyshak).
This commit is contained in:
Paul Beckingham 2014-04-12 13:32:35 -04:00
parent 32272addd0
commit 501194abfa
6 changed files with 107 additions and 5 deletions

View file

@ -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;
}
////////////////////////////////////////////////////////////////////////////////