Permalink
Browse files

#9 TI-1 Add a skeleton undo command

  • Loading branch information...
lauft committed Jul 15, 2018
1 parent 21b4b62 commit d8a4b8ff4382208a56f6da9244cd800c63963a3d
Showing with 43 additions and 2 deletions.
  1. +1 −0 src/commands/CMakeLists.txt
  2. +37 −0 src/commands/CmdUndo.cpp
  3. +2 −1 src/commands/commands.h
  4. +3 −1 src/init.cpp
@@ -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})
@@ -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;
}

////////////////////////////////////////////////////////////////////////////////
@@ -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& );
@@ -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);

0 comments on commit d8a4b8f

Please sign in to comment.