#9 TI-1 Add a skeleton undo command

This commit is contained in:
Thomas Lauf 2018-07-15 23:24:21 +02:00
parent 21b4b6242c
commit d8a4b8ff43
4 changed files with 43 additions and 2 deletions

View file

@ -32,6 +32,7 @@ set (commands_SRCS CmdCancel.cpp
CmdTag.cpp
CmdTags.cpp
CmdTrack.cpp
CmdUndo.cpp
CmdUntag.cpp)
add_library (commands STATIC ${commands_SRCS})

37
src/commands/CmdUndo.cpp Normal file
View file

@ -0,0 +1,37 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// https://www.opensource.org/licenses/mit-license.php
//
////////////////////////////////////////////////////////////////////////////////
#include <commands.h>
#include <timew.h>
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
int CmdUndo (Database& database)
{
return 0;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 - 2018, Paul Beckingham, Federico Hernandez.
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -58,6 +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 CmdUntag (const CLI&, Rules&, Database& );
int CmdChartDay (const CLI&, Rules&, Database& );

View file

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -74,6 +74,7 @@ void initializeEntities (CLI& cli)
cli.entity ("command", "tag");
cli.entity ("command", "tags");
cli.entity ("command", "track");
cli.entity ("command", "undo");
cli.entity ("command", "untag");
// Some command list themselves as extensions, to integrate with the real
@ -284,6 +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 == "untag") status = CmdUntag (cli, rules, database );
else if (command == "week") status = CmdChartWeek (cli, rules, database );
else status = CmdReport (cli, rules, database, extensions);