mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Feedback
- When bulk tasks are modified, the "project changed" messages are now retained until processing is completed, so that only one message per project is generated.
This commit is contained in:
parent
d4f85484df
commit
46b275c3ce
9 changed files with 95 additions and 13 deletions
|
@ -67,6 +67,9 @@ int CmdAppend::execute (std::string& output)
|
|||
if (!modifications.size ())
|
||||
throw std::string (STRING_CMD_MODIFY_NEED_TEXT);
|
||||
|
||||
// Accumulated project change notifications.
|
||||
std::map <std::string, std::string> projectChanges;
|
||||
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
|
@ -84,7 +87,7 @@ int CmdAppend::execute (std::string& output)
|
|||
context.tdb2.modify (*task);
|
||||
++count;
|
||||
feedback_affected (STRING_CMD_APPEND_TASK, *task);
|
||||
context.footnote (onProjectChange (*task, true));
|
||||
projectChanges[task->get ("project")] = onProjectChange (*task, true);
|
||||
|
||||
// Append to siblings.
|
||||
if (task->has ("parent"))
|
||||
|
@ -117,6 +120,12 @@ int CmdAppend::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
for (i = projectChanges.begin (); i != projectChanges.end (); ++i)
|
||||
if (i->first != "")
|
||||
context.footnote (i->second);
|
||||
|
||||
context.tdb2.commit ();
|
||||
feedback_affected (count == 1 ? STRING_CMD_APPEND_1 : STRING_CMD_APPEND_N, count);
|
||||
return rc;
|
||||
|
|
|
@ -66,6 +66,9 @@ int CmdDelete::execute (std::string& output)
|
|||
// Apply the command line modifications to the new task.
|
||||
A3 modifications = context.a3.extract_modifications ();
|
||||
|
||||
// Accumulated project change notifications.
|
||||
std::map <std::string, std::string> projectChanges;
|
||||
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
|
@ -99,7 +102,7 @@ int CmdDelete::execute (std::string& output)
|
|||
feedback_affected (STRING_CMD_DELETE_TASK, *task);
|
||||
feedback_unblocked (*task);
|
||||
dependencyChainOnComplete (*task);
|
||||
context.footnote (onProjectChange (*task, true));
|
||||
projectChanges[task->get ("project")] = onProjectChange (*task, true);
|
||||
|
||||
// Delete siblings.
|
||||
if (task->has ("parent"))
|
||||
|
@ -150,6 +153,12 @@ int CmdDelete::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
for (i = projectChanges.begin (); i != projectChanges.end (); ++i)
|
||||
if (i->first != "")
|
||||
context.footnote (i->second);
|
||||
|
||||
context.tdb2.commit ();
|
||||
feedback_affected (count == 1 ? STRING_CMD_DELETE_1 : STRING_CMD_DELETE_N, count);
|
||||
return rc;
|
||||
|
|
|
@ -65,6 +65,9 @@ int CmdDone::execute (std::string& output)
|
|||
// Apply the command line modifications to the new task.
|
||||
A3 modifications = context.a3.extract_modifications ();
|
||||
|
||||
// Accumulated project change notifications.
|
||||
std::map <std::string, std::string> projectChanges;
|
||||
|
||||
bool nagged = false;
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
|
@ -100,7 +103,7 @@ int CmdDone::execute (std::string& output)
|
|||
if (!nagged)
|
||||
nagged = nag (*task);
|
||||
dependencyChainOnComplete (*task);
|
||||
context.footnote (onProjectChange (*task, false));
|
||||
projectChanges[task->get ("project")] = onProjectChange (*task, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -118,6 +121,12 @@ int CmdDone::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
for (i = projectChanges.begin (); i != projectChanges.end (); ++i)
|
||||
if (i->first != "")
|
||||
context.footnote (i->second);
|
||||
|
||||
context.tdb2.commit ();
|
||||
feedback_affected (count == 1 ? STRING_CMD_DONE_1 : STRING_CMD_DONE_N, count);
|
||||
return rc;
|
||||
|
|
|
@ -65,6 +65,9 @@ int CmdDuplicate::execute (std::string& output)
|
|||
// Apply the command line modifications to the new task.
|
||||
A3 modifications = context.a3.extract_modifications ();
|
||||
|
||||
// Accumulated project change notifications.
|
||||
std::map <std::string, std::string> projectChanges;
|
||||
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
|
@ -114,7 +117,7 @@ int CmdDuplicate::execute (std::string& output)
|
|||
if (context.verbose ("new-id"))
|
||||
std::cout << format (STRING_CMD_ADD_FEEDBACK, context.tdb2.next_id ()) + "\n";
|
||||
|
||||
context.footnote (onProjectChange (*task, false));
|
||||
projectChanges[task->get ("project")] = onProjectChange (*task, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -123,6 +126,12 @@ int CmdDuplicate::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
for (i = projectChanges.begin (); i != projectChanges.end (); ++i)
|
||||
if (i->first != "")
|
||||
context.footnote (i->second);
|
||||
|
||||
context.tdb2.commit ();
|
||||
feedback_affected (count == 1 ? STRING_CMD_DUPLICATE_1 : STRING_CMD_DUPLICATE_N, count);
|
||||
return rc;
|
||||
|
|
|
@ -317,9 +317,19 @@ int CmdInfo::execute (std::string& output)
|
|||
Column* col = context.columns[*att];
|
||||
if (col)
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, col->label ());
|
||||
view.set (row, 1, task->get (*att));
|
||||
std::string value = task->get (*att);
|
||||
if (value != "")
|
||||
{
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, col->label ());
|
||||
//view.set (row, 1, value);
|
||||
|
||||
std::vector <std::string> lines;
|
||||
Color color;
|
||||
col->render (lines, *task, 0, color);
|
||||
join (value, " ", lines);
|
||||
view.set (row, 1, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,9 @@ int CmdModify::execute (std::string& output)
|
|||
if (!modifications.size ())
|
||||
throw std::string (STRING_CMD_MODIFY_NEED_TEXT);
|
||||
|
||||
// Accumulated project change notifications.
|
||||
std::map <std::string, std::string> projectChanges;
|
||||
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
|
@ -109,7 +112,7 @@ int CmdModify::execute (std::string& output)
|
|||
feedback_affected (STRING_CMD_MODIFY_TASK, *task);
|
||||
feedback_unblocked (*task);
|
||||
context.tdb2.modify (*task);
|
||||
context.footnote (onProjectChange (before, *task));
|
||||
projectChanges[task->get ("project")] = onProjectChange (before, *task);
|
||||
|
||||
// Task potentially has siblings - modify them.
|
||||
if (task->has ("parent"))
|
||||
|
@ -129,7 +132,7 @@ int CmdModify::execute (std::string& output)
|
|||
feedback_affected (STRING_CMD_MODIFY_TASK_R, *sibling);
|
||||
feedback_unblocked (*sibling);
|
||||
context.tdb2.modify (*sibling);
|
||||
context.footnote (onProjectChange (alternate, *sibling));
|
||||
projectChanges[sibling->get ("project")] = onProjectChange (alternate, *sibling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +152,7 @@ int CmdModify::execute (std::string& output)
|
|||
updateRecurrenceMask (*child);
|
||||
context.tdb2.modify (*child);
|
||||
dependencyChainOnModify (alternate, *child);
|
||||
context.footnote (onProjectChange (alternate, *child));
|
||||
projectChanges[child->get ("project")] = onProjectChange (alternate, *child);
|
||||
++count;
|
||||
feedback_affected (STRING_CMD_MODIFY_TASK_R, *child);
|
||||
}
|
||||
|
@ -164,6 +167,12 @@ int CmdModify::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
for (i = projectChanges.begin (); i != projectChanges.end (); ++i)
|
||||
if (i->first != "")
|
||||
context.footnote (i->second);
|
||||
|
||||
context.tdb2.commit ();
|
||||
feedback_affected (count == 1 ? STRING_CMD_MODIFY_1 : STRING_CMD_MODIFY_N, count);
|
||||
return rc;
|
||||
|
|
|
@ -67,6 +67,9 @@ int CmdPrepend::execute (std::string& output)
|
|||
if (!modifications.size ())
|
||||
throw std::string (STRING_CMD_MODIFY_NEED_TEXT);
|
||||
|
||||
// Accumulated project change notifications.
|
||||
std::map <std::string, std::string> projectChanges;
|
||||
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
|
@ -84,7 +87,7 @@ int CmdPrepend::execute (std::string& output)
|
|||
context.tdb2.modify (*task);
|
||||
++count;
|
||||
feedback_affected (STRING_CMD_PREPEND_TASK, *task);
|
||||
context.footnote (onProjectChange (*task, true));
|
||||
projectChanges[task->get ("project")] = onProjectChange (*task, true);
|
||||
|
||||
// Prepend to siblings.
|
||||
if (task->has ("parent"))
|
||||
|
@ -117,6 +120,12 @@ int CmdPrepend::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
for (i = projectChanges.begin (); i != projectChanges.end (); ++i)
|
||||
if (i->first != "")
|
||||
context.footnote (i->second);
|
||||
|
||||
context.tdb2.commit ();
|
||||
feedback_affected (count == 1 ? STRING_CMD_PREPEND_1 : STRING_CMD_PREPEND_N, count);
|
||||
return rc;
|
||||
|
|
|
@ -65,6 +65,9 @@ int CmdStart::execute (std::string& output)
|
|||
// Apply the command line modifications to the new task.
|
||||
A3 modifications = context.a3.extract_modifications ();
|
||||
|
||||
// Accumulated project change notifications.
|
||||
std::map <std::string, std::string> projectChanges;
|
||||
|
||||
bool nagged = false;
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
|
@ -93,7 +96,7 @@ int CmdStart::execute (std::string& output)
|
|||
if (!nagged)
|
||||
nagged = nag (*task);
|
||||
dependencyChainOnStart (*task);
|
||||
context.footnote (onProjectChange (*task, false));
|
||||
projectChanges[task->get ("project")] = onProjectChange (*task, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -111,6 +114,12 @@ int CmdStart::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
for (i = projectChanges.begin (); i != projectChanges.end (); ++i)
|
||||
if (i->first != "")
|
||||
context.footnote (i->second);
|
||||
|
||||
context.tdb2.commit ();
|
||||
feedback_affected (count == 1 ? STRING_CMD_START_1 : STRING_CMD_START_N, count);
|
||||
return rc;
|
||||
|
|
|
@ -64,6 +64,9 @@ int CmdStop::execute (std::string& output)
|
|||
// Apply the command line modifications to the new task.
|
||||
A3 modifications = context.a3.extract_modifications ();
|
||||
|
||||
// Accumulated project change notifications.
|
||||
std::map <std::string, std::string> projectChanges;
|
||||
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
|
@ -89,7 +92,7 @@ int CmdStop::execute (std::string& output)
|
|||
++count;
|
||||
feedback_affected (STRING_CMD_STOP_TASK, *task);
|
||||
dependencyChainOnStart (*task);
|
||||
context.footnote (onProjectChange (*task, false));
|
||||
projectChanges[task->get ("project")] = onProjectChange (*task, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -107,6 +110,12 @@ int CmdStop::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
|
||||
// Now list the project changes.
|
||||
std::map <std::string, std::string>::iterator i;
|
||||
for (i = projectChanges.begin (); i != projectChanges.end (); ++i)
|
||||
if (i->first != "")
|
||||
context.footnote (i->second);
|
||||
|
||||
context.tdb2.commit ();
|
||||
feedback_affected (count == 1 ? STRING_CMD_STOP_1 : STRING_CMD_STOP_N, count);
|
||||
return rc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue