CmdAdd: Make sure a UUID is printed if ID does not exist

This fixes a regression was introduced in
4e80d5d5fd.

Currently, if a user (with default configuration) adds a completed or
deleted task, they do not get a confirmation message ("Created task
..."). This is due to the fact that:
a) new-uuid is not set by default
b) new-id is set by default, but only prints message if the added task
   is in pending or waiting state

Make sure to print a message containing UUID reference if the newly
added task is in completed or deleted state.
This commit is contained in:
Tomas Babej 2020-09-18 00:24:47 -04:00
parent e186d375dc
commit 10b64adb58
No known key found for this signature in database
GPG key ID: B0747C6578F7D2F5

View file

@ -63,13 +63,15 @@ int CmdAdd::execute (std::string& output)
// asked for this if they just wanted a human-friendly number.
if (Context::getContext ().verbose ("new-uuid") &&
status != Task::recurring)
output += format ("Created task {1}.\n", task.get ("uuid"));
else if (Context::getContext ().verbose ("new-uuid") &&
status == Task::recurring)
output += format ("Created task {1} (recurrence template).\n", task.get ("uuid"));
else if (Context::getContext ().verbose ("new-uuid") ||
(Context::getContext ().verbose ("new-id") &&
(status == Task::completed ||
status == Task::deleted)))
output += format ("Created task {1}.\n", task.get ("uuid"));
else if (Context::getContext ().verbose ("new-id") &&
(status == Task::pending ||
status == Task::waiting))