mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
#9 TI-1: Add informative output to undo command
This commit is contained in:
parent
2dfc1707b4
commit
86258cdb93
3 changed files with 13 additions and 3 deletions
|
@ -27,9 +27,10 @@
|
|||
#include <commands.h>
|
||||
#include <timew.h>
|
||||
#include <iostream>
|
||||
#include <format.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdUndo (Database& database)
|
||||
int CmdUndo (Rules& rules, Database& database)
|
||||
{
|
||||
Transaction transaction = database.popLastTransaction ();
|
||||
|
||||
|
@ -38,6 +39,10 @@ int CmdUndo (Database& database)
|
|||
if (actions.empty ())
|
||||
{
|
||||
// No (more) undoing...
|
||||
if (rules.getBoolean ("verbose"))
|
||||
{
|
||||
std::cout << "Nothing to undo." << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -46,6 +51,11 @@ int CmdUndo (Database& database)
|
|||
// Select database...
|
||||
// Rollback action...
|
||||
}
|
||||
|
||||
if (rules.getBoolean ("verbose"))
|
||||
{
|
||||
std::cout << "Undo" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -58,7 +58,7 @@ int CmdStop (const CLI&, Rules&, Database& );
|
|||
int CmdTag (const CLI&, Rules&, Database& );
|
||||
int CmdTags (const CLI&, Rules&, Database& );
|
||||
int CmdTrack (const CLI&, Rules&, Database& );
|
||||
int CmdUndo ( Database& );
|
||||
int CmdUndo ( Rules&, Database& );
|
||||
int CmdUntag (const CLI&, Rules&, Database& );
|
||||
|
||||
int CmdChartDay (const CLI&, Rules&, Database& );
|
||||
|
|
|
@ -285,7 +285,7 @@ int dispatchCommand (
|
|||
else if (command == "tag") status = CmdTag (cli, rules, database );
|
||||
else if (command == "tags") status = CmdTags (cli, rules, database );
|
||||
else if (command == "track") status = CmdTrack (cli, rules, database );
|
||||
else if (command == "undo") status = CmdUndo ( database );
|
||||
else if (command == "undo") status = CmdUndo ( rules, database );
|
||||
else if (command == "untag") status = CmdUntag (cli, rules, database );
|
||||
else if (command == "week") status = CmdChartWeek (cli, rules, database );
|
||||
else status = CmdReport (cli, rules, database, extensions);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue