mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
TW-1704: Task: Use Task::identifier to reference the task
To achieve consistent output, use a helper method to generate a proper handle - ID for tasks with non-zero ID, UUID otherwise.
This commit is contained in:
parent
1236abc7d5
commit
2d25cf6f59
16 changed files with 50 additions and 57 deletions
|
@ -79,7 +79,7 @@ int CmdAnnotate::execute (std::string&)
|
|||
|
||||
// Annotate the specified task.
|
||||
std::string question = format (STRING_CMD_ANNO_CONFIRM,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
task.modify (Task::modAnnotate, true);
|
||||
|
|
|
@ -79,7 +79,7 @@ int CmdAppend::execute (std::string&)
|
|||
|
||||
// Append to the specified task.
|
||||
std::string question = format (STRING_CMD_APPEND_CONFIRM,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
task.modify (Task::modAppend, true);
|
||||
|
|
|
@ -80,14 +80,9 @@ int CmdDelete::execute (std::string&)
|
|||
{
|
||||
// Delete the specified task.
|
||||
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"));
|
||||
question = format (STRING_CMD_DELETE_CONFIRM,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
task.modify (Task::modAnnotate);
|
||||
task.setStatus (Task::deleted);
|
||||
|
@ -173,7 +168,7 @@ int CmdDelete::execute (std::string&)
|
|||
else
|
||||
{
|
||||
std::cout << format (STRING_CMD_DELETE_NOT_DEL,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"))
|
||||
<< "\n";
|
||||
rc = 1;
|
||||
|
|
|
@ -127,7 +127,7 @@ int CmdDenotate::execute (std::string&)
|
|||
if (before != task)
|
||||
{
|
||||
std::string question = format (STRING_CMD_DENO_CONFIRM,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
|
|
|
@ -81,7 +81,7 @@ int CmdDone::execute (std::string&)
|
|||
{
|
||||
// Complete the specified task.
|
||||
std::string question = format (STRING_CMD_DONE_CONFIRM,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
task.modify (Task::modAnnotate);
|
||||
|
@ -121,7 +121,7 @@ int CmdDone::execute (std::string&)
|
|||
else
|
||||
{
|
||||
std::cout << format (STRING_CMD_DONE_NOTPEND,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"))
|
||||
<< "\n";
|
||||
rc = 1;
|
||||
|
|
|
@ -88,7 +88,7 @@ int CmdDuplicate::execute (std::string&)
|
|||
dup.remove ("recur");
|
||||
dup.remove ("until");
|
||||
dup.remove ("imask");
|
||||
std::cout << format (STRING_CMD_DUPLICATE_NON_REC, task.id)
|
||||
std::cout << format (STRING_CMD_DUPLICATE_NON_REC, task.identifier ())
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ int CmdDuplicate::execute (std::string&)
|
|||
else if (dup.getStatus () == Task::recurring)
|
||||
{
|
||||
dup.remove ("mask");
|
||||
std::cout << format (STRING_CMD_DUPLICATE_REC, task.id)
|
||||
std::cout << format (STRING_CMD_DUPLICATE_REC, task.identifier ())
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ int CmdDuplicate::execute (std::string&)
|
|||
dup.modify (Task::modAnnotate);
|
||||
|
||||
if (permission (format (STRING_CMD_DUPLICATE_CONFIRM,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description")),
|
||||
filtered.size ()))
|
||||
{
|
||||
|
|
|
@ -82,14 +82,9 @@ int CmdModify::execute (std::string&)
|
|||
checkConsistency(before, task);
|
||||
|
||||
std::string question;
|
||||
if (task.id != 0)
|
||||
question = format (STRING_CMD_MODIFY_CONFIRM,
|
||||
task.id,
|
||||
task.get ("description"));
|
||||
else
|
||||
question = format (STRING_CMD_MODIFY_CONFIRM,
|
||||
task.get ("uuid"),
|
||||
task.get ("description"));
|
||||
question = format (STRING_CMD_MODIFY_CONFIRM,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
if (permission (taskDifferences (before, task) + question, filtered.size ()))
|
||||
{
|
||||
|
|
|
@ -79,7 +79,7 @@ int CmdPrepend::execute (std::string&)
|
|||
|
||||
// Prepend to the specified task.
|
||||
std::string question = format (STRING_CMD_PREPEND_CONFIRM,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
task.modify (Task::modPrepend, true);
|
||||
|
|
|
@ -80,7 +80,7 @@ int CmdStart::execute (std::string&)
|
|||
|
||||
// Start the specified task.
|
||||
std::string question = format (STRING_CMD_START_CONFIRM,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
task.modify (Task::modAnnotate);
|
||||
task.setAsNow ("start");
|
||||
|
|
|
@ -78,7 +78,7 @@ int CmdStop::execute (std::string&)
|
|||
|
||||
// Stop the specified task.
|
||||
std::string question = format (STRING_CMD_STOP_CONFIRM,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"));
|
||||
|
||||
task.modify (Task::modAnnotate);
|
||||
|
@ -108,7 +108,7 @@ int CmdStop::execute (std::string&)
|
|||
else
|
||||
{
|
||||
std::cout << format (STRING_CMD_STOP_ALREADY,
|
||||
task.id,
|
||||
task.identifier (true),
|
||||
task.get ("description"))
|
||||
<< "\n";
|
||||
rc = 1;
|
||||
|
|
|
@ -70,19 +70,10 @@ int CmdUrgency::execute (std::string& output)
|
|||
std::stringstream out;
|
||||
for (auto& task : filtered)
|
||||
{
|
||||
if (task.id)
|
||||
{
|
||||
out << format (STRING_CMD_URGENCY_RESULT,
|
||||
task.id, trim (format (task.urgency (), 6, 3)))
|
||||
<< "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << format (STRING_CMD_URGENCY_RESULT,
|
||||
task.get ("uuid"),
|
||||
trim (format (task.urgency (), 6, 3)))
|
||||
<< "\n";
|
||||
}
|
||||
out << format (STRING_CMD_URGENCY_RESULT,
|
||||
task.identifier (),
|
||||
trim (format (task.urgency (), 6, 3)))
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
output = out.str ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue