Feedback
- Implemented consistent 'affected' feedback across all write commands.
This commit is contained in:
@@ -25,10 +25,10 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
@@ -296,12 +296,40 @@ std::string renderAttribute (const std::string& name, const std::string& value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// TODO Implement all the post-command feedback here. This includes project
|
// Implements:
|
||||||
// completion percentages, "3 tasks modified", all warnings, and so on.
|
// Deleted 3 tasks
|
||||||
std::string feedback (const Task&, const Task&)
|
//
|
||||||
|
// The 'effect' string should contain:
|
||||||
|
// {1} Quantity
|
||||||
|
void feedback_affected (const std::string& effect, int quantity)
|
||||||
{
|
{
|
||||||
|
if (context.verbose ("affected") ||
|
||||||
|
context.config.getBoolean ("echo.command")) // Deprecated 2.0
|
||||||
|
{
|
||||||
|
std::cout << format (effect, quantity)
|
||||||
|
<< "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Implements:
|
||||||
|
// Deleting task 123 'This is a test'
|
||||||
|
//
|
||||||
|
// The 'effect' string should contain:
|
||||||
|
// {1} ID
|
||||||
|
// {2} Description
|
||||||
|
void feedback_affected (const std::string& effect, const Task& task)
|
||||||
|
{
|
||||||
|
if (context.verbose ("affected") ||
|
||||||
|
context.config.getBoolean ("echo.command")) // Deprecated 2.0
|
||||||
|
{
|
||||||
|
if (task.id)
|
||||||
|
std::cout << format (effect, task.id, task.get ("description"))
|
||||||
|
<< "\n";
|
||||||
|
else
|
||||||
|
std::cout << format (effect, task.get ("uuid"), task.get ("description"))
|
||||||
|
<< "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -74,7 +74,8 @@ bool taskDiff (const Task&, const Task&);
|
|||||||
std::string taskDifferences (const Task&, const Task&);
|
std::string taskDifferences (const Task&, const Task&);
|
||||||
std::string taskInfoDifferences (const Task&, const Task&);
|
std::string taskInfoDifferences (const Task&, const Task&);
|
||||||
std::string renderAttribute (const std::string&, const std::string&);
|
std::string renderAttribute (const std::string&, const std::string&);
|
||||||
std::string feedback (const Task&, const Task&);
|
void feedback_affected (const std::string&, const Task&);
|
||||||
|
void feedback_affected (const std::string&, int);
|
||||||
|
|
||||||
// sort.cpp
|
// sort.cpp
|
||||||
void sort_tasks (std::vector <Task>&, std::vector <int>&, const std::string&);
|
void sort_tasks (std::vector <Task>&, std::vector <int>&, const std::string&);
|
||||||
|
|||||||
Reference in New Issue
Block a user