- Fixed bug that caused Att::match to assume a Date was not already
  converted to an epoch.
This commit is contained in:
Paul Beckingham 2009-06-26 00:05:33 -04:00
parent 53155fcc34
commit 0440189b1d
2 changed files with 6 additions and 8 deletions

View file

@ -236,7 +236,6 @@ bool Att::validNameValue (
autoComplete (name, candidates, matches); autoComplete (name, candidates, matches);
if (matches.size () == 0) if (matches.size () == 0)
// throw std::string ("Unrecognized attribute '") + name + "'";
return false; return false;
else if (matches.size () != 1) else if (matches.size () != 1)
@ -559,7 +558,7 @@ bool Att::match (const Att& other) const
} }
else if (which == "date") else if (which == "date")
{ {
Date literal (mValue); Date literal ((time_t)::atoi (mValue.c_str ()));
Date variable ((time_t)::atoi (other.mValue.c_str ())); Date variable ((time_t)::atoi (other.mValue.c_str ()));
if (! (variable < literal)) if (! (variable < literal))
return false; return false;
@ -589,7 +588,7 @@ bool Att::match (const Att& other) const
} }
else if (which == "date") else if (which == "date")
{ {
Date literal (mValue); Date literal ((time_t)::atoi (mValue.c_str ()));
Date variable ((time_t)::atoi (other.mValue.c_str ())); Date variable ((time_t)::atoi (other.mValue.c_str ()));
if (! (variable > literal)) if (! (variable > literal))
return false; return false;

View file

@ -552,12 +552,7 @@ void Context::parse (
// At this point, either a sequence or a command should have been found. // At this point, either a sequence or a command should have been found.
if (parseSequence.size () == 0 && parseCmd.command == "") if (parseSequence.size () == 0 && parseCmd.command == "")
{
parseCmd.parse (descCandidate); parseCmd.parse (descCandidate);
throw stringtable.get (
CMD_MISSING,
"You must specify a command, or a task ID to modify");
}
// Read-only command (reports, status, info ...) use filters. Write commands // Read-only command (reports, status, info ...) use filters. Write commands
// (add, done ...) do not. // (add, done ...) do not.
@ -580,6 +575,10 @@ void Context::parse (
initialize (); initialize ();
parse (args, cmd, task, sequence, subst, filter); parse (args, cmd, task, sequence, subst, filter);
} }
else
throw stringtable.get (
CMD_MISSING,
"You must specify a command, or a task ID to modify");
} }
} }