mirror of
https://github.com/GothenburgBitFactory/taskshell.git
synced 2025-06-26 10:54:29 +02:00
TS-28: Please add a (m)odify feature for review
- Thanks to Ian R. Learmonth.
This commit is contained in:
parent
cbb7959833
commit
bd7162f58d
3 changed files with 63 additions and 27 deletions
1
AUTHORS
1
AUTHORS
|
@ -19,3 +19,4 @@ suggestions:
|
|||
jonbobbly
|
||||
hosaka
|
||||
Lars Kumbier
|
||||
Ian R. Learmonth
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
(thanks to Lars Kumbier).
|
||||
- TS-24 add review option (m)odify
|
||||
(thanks to David Patrick).
|
||||
- TS-28 Please add a (m)odify feature for review
|
||||
(thanks to Ian R. Learmonth).
|
||||
- Implemented 'review' command.
|
||||
- Implemented 'diag' command.
|
||||
- Added 'review N' option, to specify the number of tasks you would like to
|
||||
|
|
|
@ -85,6 +85,23 @@ static void editTask (const std::string& uuid)
|
|||
std::cout << "Modified.\n\n\n\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static void modifyTask (const std::string& uuid)
|
||||
{
|
||||
Color text ("color15 on gray6");
|
||||
std::string modifications;
|
||||
do
|
||||
{
|
||||
modifications = getResponse (text.colorize (" Enter modification args [example: +tag -tag /teh/the/ project:X] ") + " ");
|
||||
}
|
||||
while (modifications == "");
|
||||
|
||||
std::string command = "task rc.confirmation:no rc.verbose:nothing " + uuid + " modify " + modifications;
|
||||
system (command.c_str ());
|
||||
|
||||
std::cout << "Modified.\n\n\n\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static void reviewTask (const std::string& uuid)
|
||||
{
|
||||
|
@ -171,15 +188,20 @@ static const std::string banner (
|
|||
static const std::string menu ()
|
||||
{
|
||||
Color text ("color15 on gray6");
|
||||
return text.colorize (" (Enter) Mark as reviewed, (s)kip, (e)dit, (c)ompleted, (d)eleted, (q)uit ");
|
||||
return text.colorize (" (Enter) Mark as reviewed, (s)kip, (e)dit, (m)odify, (c)ompleted, (d)eleted, (q)uit ") + " ";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static void reviewLoop (const std::vector <std::string>& uuids, unsigned int limit, bool autoClear)
|
||||
{
|
||||
unsigned int reviewed = 0;
|
||||
auto total = std::min (static_cast <unsigned int> (uuids.size ()), limit);
|
||||
auto width = getWidth ();
|
||||
unsigned int reviewed = 0;
|
||||
|
||||
// If a limit was specified ('review 10'), then it should override the data
|
||||
// set size, if it is smaller.
|
||||
unsigned int total = uuids.size ();
|
||||
if (limit)
|
||||
total = std::min (total, limit);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
|
@ -204,6 +226,11 @@ static void reviewLoop (const std::vector <std::string>& uuids, unsigned int lim
|
|||
dummy,
|
||||
description);
|
||||
|
||||
std::string response;
|
||||
bool repeat;
|
||||
do
|
||||
{
|
||||
repeat = false;
|
||||
std::cout << banner (current + 1, total, width, Lexer::trimRight (description, "\n"));
|
||||
|
||||
// Use 'system' to run the command and show the output.
|
||||
|
@ -211,9 +238,10 @@ static void reviewLoop (const std::vector <std::string>& uuids, unsigned int lim
|
|||
system (command.c_str ());
|
||||
|
||||
// Display prompt, get input.
|
||||
auto response = getResponse (menu ());
|
||||
response = getResponse (menu ());
|
||||
|
||||
if (response == "e") { editTask (uuid); }
|
||||
if (response == "m") { modifyTask (uuid); repeat = true; }
|
||||
else if (response == "s") { std::cout << "Skipped\n\n"; ++current; }
|
||||
else if (response == "c") { completeTask (uuid); ++current; ++reviewed; }
|
||||
else if (response == "d") { deleteTask (uuid); ++current; ++reviewed; }
|
||||
|
@ -232,6 +260,11 @@ static void reviewLoop (const std::vector <std::string>& uuids, unsigned int lim
|
|||
if (autoClear)
|
||||
std::cout << "\033[2J\033[0;0H";
|
||||
}
|
||||
while (repeat);
|
||||
|
||||
if (response == "q")
|
||||
break;
|
||||
}
|
||||
|
||||
std::cout << "\n"
|
||||
<< format ("End of review. {1} out of {2} tasks reviewed.", reviewed, total)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue