From 0db5598aa690e63ebd1e363cabada4fdb632c8c9 Mon Sep 17 00:00:00 2001 From: Thomas Lauf Date: Sun, 9 Aug 2020 19:02:24 +0200 Subject: [PATCH] Add brackets to if-/for-statement Signed-off-by: Thomas Lauf --- src/commands/CmdCancel.cpp | 2 ++ src/commands/CmdFill.cpp | 2 ++ src/commands/CmdStop.cpp | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/src/commands/CmdCancel.cpp b/src/commands/CmdCancel.cpp index 9f88856d..59954e29 100644 --- a/src/commands/CmdCancel.cpp +++ b/src/commands/CmdCancel.cpp @@ -52,7 +52,9 @@ int CmdCancel ( journal.endTransaction (); if (verbose) + { std::cout << "Canceled active time tracking.\n"; + } return 0; } diff --git a/src/commands/CmdFill.cpp b/src/commands/CmdFill.cpp index c79c7938..a5392a0a 100644 --- a/src/commands/CmdFill.cpp +++ b/src/commands/CmdFill.cpp @@ -42,7 +42,9 @@ int CmdFill ( std::set ids = cli.getIds (); if (ids.empty ()) + { throw std::string ("IDs must be specified. See 'timew help fill'."); + } // Load the data. // Note: There is no filter. diff --git a/src/commands/CmdStop.cpp b/src/commands/CmdStop.cpp index 89b4ca7b..609ae4a2 100644 --- a/src/commands/CmdStop.cpp +++ b/src/commands/CmdStop.cpp @@ -96,7 +96,9 @@ int CmdStop ( database.addInterval (interval, verbose); if (verbose) + { std::cout << intervalSummarize (database, rules, interval); + } } // If tags are specified, but are not a full set of tags, remove them @@ -105,10 +107,16 @@ int CmdStop ( setIntersect (filter.tags (), latest.tags ()).size () != latest.tags ().size ()) { for (auto& tag : filter.tags ()) + { if (modified.hasTag (tag)) + { modified.untag (tag); + } else + { throw format ("The current interval does not have the '{1}' tag.", tag); + } + } } // Open a new interval with remaining tags, if any. @@ -120,7 +128,9 @@ int CmdStop ( validate (cli, rules, database, modified); database.addInterval (modified, verbose); if (verbose) + { std::cout << '\n' << intervalSummarize (database, rules, modified); + } } journal.endTransaction ();