diff --git a/src/commands/CmdStop.cpp b/src/commands/CmdStop.cpp index 24af3da7..03791805 100644 --- a/src/commands/CmdStop.cpp +++ b/src/commands/CmdStop.cpp @@ -81,7 +81,7 @@ int CmdStop ( } else { - std::string message = "There is no time currently being tracked."; + std::string message = "There is no active time tracking."; std::cout << message << "\n"; log.write ("warning", message); } diff --git a/src/helper.cpp b/src/helper.cpp index 2c6d7556..ec1d1907 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -28,6 +28,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////// Color tagColor (const Rules& rules, const std::string& tag) @@ -44,42 +45,38 @@ Color tagColor (const Rules& rules, const std::string& tag) std::string intervalSummarize (const Rules& rules, const Interval& interval) { std::stringstream out; - if (interval.isStarted ()) { + // Combine and colorize tags. + std::string tags; + for (auto& tag : interval.tags ()) + { + if (tags != "") + tags += " "; + + tags += tagColor (rules, tag).colorize (quoteIfNeeded (tag)); + } + + // Interval closed. if (interval.isEnded ()) { Duration dur (Datetime (interval.end ()) - Datetime (interval.start ())); - out << "Recorded interval from " - << interval.start ().toISOLocalExtended () - << " to " - << interval.end ().toISOLocalExtended () - << " (" - << dur.format () - << ")"; + out << "Recorded " << tags << "\n" + << " Started " << interval.start ().toISOLocalExtended () << "\n" + << " Ended " << interval.end ().toISOLocalExtended () << "\n" + << " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << "\n"; } + + // Interval open. else { Duration dur (Datetime () - interval.start ()); - out << "Active interval since " - << interval.start ().toISOLocalExtended (); + out << "Tracking " << tags << "\n" + << " Started " << interval.start ().toISOLocalExtended () << "\n"; if (dur.toTime_t () > 10) - out << " (" - << dur.format () - << ")"; + out << " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << "\n"; } - - // Colorize tags. - auto tags = interval.tags (); - if (tags.size ()) - { - out << ", tagged:"; - for (auto& tag : tags) - out << ' ' << tagColor (rules, tag).colorize (quoteIfNeeded (tag)); - } - - out << "\n"; } return out.str ();