- Allows the deletion of an already-completed task, provided it is
  addressed by UUID.
- Displays UUID in cases where there is no ID.
This commit is contained in:
Paul Beckingham 2011-10-22 23:44:54 -04:00
parent 28133f8567
commit fce2469f41
3 changed files with 21 additions and 7 deletions

View file

@ -71,13 +71,20 @@ int CmdDelete::execute (std::string& output)
{
Task before (*task);
if (task->getStatus () == Task::pending ||
if (task->getStatus () == Task::pending ||
task->getStatus () == Task::completed ||
task->getStatus () == Task::waiting)
{
// Delete the specified task.
std::string question = format (STRING_CMD_DELETE_CONFIRM,
task->id,
task->get ("description"));
std::string question;
if (task->id)
question = format (STRING_CMD_DELETE_CONFIRM,
task->id,
task->get ("description"));
else
question = format (STRING_CMD_DELETE_CONFIRM,
task->get ("uuid"),
task->get ("description"));
modify_task_annotate (*task, modifications);
task->setStatus (Task::deleted);
@ -133,7 +140,7 @@ int CmdDelete::execute (std::string& output)
}
else
{
std::cout << format (STRING_CMD_DELETE_NOTPEND,
std::cout << format (STRING_CMD_DELETE_NOT_DEL,
task->id,
task->get ("description"))
<< "\n";