mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Cleanup: Replaced "\n" with '\n'
This commit is contained in:
parent
9e6ee03354
commit
49715320ef
20 changed files with 151 additions and 151 deletions
|
@ -335,13 +335,13 @@ std::string CLI::dump (const std::string& title) const
|
|||
out << colorArgs.colorize (i->attribute ("raw"));
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
out << '\n';
|
||||
|
||||
if (_args.size ())
|
||||
{
|
||||
out << " _args\n";
|
||||
for (auto& a : _args)
|
||||
out << " " << a.dump () << "\n";
|
||||
out << " " << a.dump () << '\n';
|
||||
}
|
||||
|
||||
return out.str ();
|
||||
|
|
|
@ -166,7 +166,7 @@ std::string Database::dump () const
|
|||
std::stringstream out;
|
||||
out << "Database\n";
|
||||
for (auto& exclusion : _exclusions)
|
||||
out << " Exclusion: " << exclusion << "\n";
|
||||
out << " Exclusion: " << exclusion << '\n';
|
||||
|
||||
for (auto& df : _files)
|
||||
out << df.dump ();
|
||||
|
|
|
@ -154,7 +154,7 @@ void Datafile::commit ()
|
|||
|
||||
// Write out all the lines.
|
||||
for (auto& line : _lines)
|
||||
_file.write_raw (line + "\n");
|
||||
_file.write_raw (line + '\n');
|
||||
|
||||
_file.close ();
|
||||
_dirty = false;
|
||||
|
@ -169,13 +169,13 @@ std::string Datafile::dump () const
|
|||
{
|
||||
std::stringstream out;
|
||||
out << "Datafile\n"
|
||||
<< " Name: " << _file.name () << (_file.exists () ? "" : " (does not exist)") << "\n"
|
||||
<< " dirty: " << (_dirty ? "true" : "false") << "\n"
|
||||
<< " lines: " << _lines.size () << "\n"
|
||||
<< " loaded " << (_lines_loaded ? "true" : "false") << "\n"
|
||||
<< " exclusions: " << _exclusions.size () << "\n"
|
||||
<< " Name: " << _file.name () << (_file.exists () ? "" : " (does not exist)") << '\n'
|
||||
<< " dirty: " << (_dirty ? "true" : "false") << '\n'
|
||||
<< " lines: " << _lines.size () << '\n'
|
||||
<< " loaded " << (_lines_loaded ? "true" : "false") << '\n'
|
||||
<< " exclusions: " << _exclusions.size () << '\n'
|
||||
<< " range: " << _range.start.toISO () << " - "
|
||||
<< _range.end.toISO () << "\n";
|
||||
<< _range.end.toISO () << '\n';
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ std::string Exclusion::serialize () const
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Exclusion::dump () const
|
||||
{
|
||||
return std::string ("Exclusion ") + join (" ", _tokens) + "\n";
|
||||
return std::string ("Exclusion ") + join (" ", _tokens) + '\n';
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -68,11 +68,11 @@ int Extensions::callExtension (
|
|||
{
|
||||
if (_debug)
|
||||
{
|
||||
std::cout << "Extension: Calling " << script << "\n"
|
||||
std::cout << "Extension: Calling " << script << '\n'
|
||||
<< "Extension: input";
|
||||
|
||||
for (auto& i : input)
|
||||
std::cout << " " << i << "\n";
|
||||
std::cout << " " << i << '\n';
|
||||
}
|
||||
|
||||
auto inputStr = join ("\n", input);
|
||||
|
@ -94,7 +94,7 @@ int Extensions::callExtension (
|
|||
output = split (outputStr, '\n');
|
||||
|
||||
if (_debug)
|
||||
std::cout << "Extension: Completed with status " << status << "\n";
|
||||
std::cout << "Extension: Completed with status " << status << '\n';
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ std::string Extensions::dump () const
|
|||
|
||||
out << "Extensions\n";
|
||||
for (auto& script : _scripts)
|
||||
out << " " << script << "\n";
|
||||
out << " " << script << '\n';
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
|
|
@ -170,11 +170,11 @@ std::string Rules::dump () const
|
|||
std::stringstream out;
|
||||
out << "Rules\n"
|
||||
<< " _original_file " << _original_file
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
out << " Settings\n";
|
||||
for (auto& item : _settings)
|
||||
out << " " << item.first << "=" << item.second << "\n";
|
||||
out << " " << item.first << "=" << item.second << '\n';
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ void Rules::parse (const std::string& input, int nest /* = 1 */)
|
|||
}
|
||||
else
|
||||
{
|
||||
ruleDef += line + "\n";
|
||||
ruleDef += line + '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ void Rules::parse (const std::string& input, int nest /* = 1 */)
|
|||
}
|
||||
|
||||
inRule = true;
|
||||
ruleDef = line + "\n";
|
||||
ruleDef = line + '\n';
|
||||
}
|
||||
|
||||
// Top-level import:
|
||||
|
|
|
@ -117,7 +117,7 @@ std::string Timeline::dump () const
|
|||
{
|
||||
std::stringstream out;
|
||||
|
||||
out << "Timeline range " << range.dump () << "\n";
|
||||
out << "Timeline range " << range.dump () << '\n';
|
||||
for (auto& i : _inclusions)
|
||||
out << " " << i.json ();
|
||||
for (auto& e : _exclusions)
|
||||
|
|
|
@ -68,9 +68,9 @@ int CmdDiagnostics (
|
|||
const Extensions& extensions)
|
||||
{
|
||||
std::stringstream out;
|
||||
out << "\n"
|
||||
out << '\n'
|
||||
<< PACKAGE_STRING
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
out << " Platform: " << osName ()
|
||||
<< "\n\n";
|
||||
|
@ -78,7 +78,7 @@ int CmdDiagnostics (
|
|||
// Compiler.
|
||||
out << "Compiler:\n"
|
||||
#ifdef __VERSION__
|
||||
<< " Version: " << __VERSION__ << "\n"
|
||||
<< " Version: " << __VERSION__ << '\n'
|
||||
#endif
|
||||
<< " Caps:"
|
||||
#ifdef __STDC__
|
||||
|
@ -107,7 +107,7 @@ int CmdDiagnostics (
|
|||
<< " +l" << 8 * sizeof (long)
|
||||
<< " +vp" << 8 * sizeof (void*)
|
||||
<< " +time_t" << 8 * sizeof (time_t)
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// Compiler compliance level.
|
||||
std::string compliance = "non-compliant";
|
||||
|
@ -127,11 +127,11 @@ int CmdDiagnostics (
|
|||
out << "Build Features\n"
|
||||
|
||||
// Build date.
|
||||
<< " Built: " << __DATE__ << " " << __TIME__ << "\n"
|
||||
<< " Built: " << __DATE__ << " " << __TIME__ << '\n'
|
||||
#ifdef HAVE_COMMIT
|
||||
<< " Commit: " << COMMIT << "\n"
|
||||
<< " Commit: " << COMMIT << '\n'
|
||||
#endif
|
||||
<< " CMake: " << CMAKE_VERSION << "\n";
|
||||
<< " CMake: " << CMAKE_VERSION << '\n';
|
||||
|
||||
out << " Build type: "
|
||||
#ifdef CMAKE_BUILD_TYPE
|
||||
|
@ -152,37 +152,37 @@ int CmdDiagnostics (
|
|||
<< ", mode "
|
||||
<< std::setbase (8)
|
||||
<< context.config._original_file.mode ()
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
*/
|
||||
|
||||
char* env = getenv ("TIMEWARRIORDB");
|
||||
out << " TIMEWARRIORDB: "
|
||||
<< (env ? env : "-")
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
File cfg (rules.get ("temp.db") + "/timewarrior.cfg");
|
||||
out << " Cfg: " << describeFile (cfg) << "\n";
|
||||
out << " Cfg: " << describeFile (cfg) << '\n';
|
||||
|
||||
Directory db (rules.get ("temp.db"));
|
||||
out << " Database: " << describeFile (db) << "\n";
|
||||
out << " Database: " << describeFile (db) << '\n';
|
||||
|
||||
for (auto& file : database.files ())
|
||||
{
|
||||
File df (rules.get ("temp.db") + "/data");
|
||||
df += file;
|
||||
out << " " << describeFile (df) << "\n";
|
||||
out << " " << describeFile (df) << '\n';
|
||||
}
|
||||
|
||||
// Determine rc.editor/$EDITOR/$VISUAL.
|
||||
char* peditor;
|
||||
if ((peditor = getenv ("VISUAL")) != NULL)
|
||||
out << " $VISUAL: " << peditor << "\n";
|
||||
out << " $VISUAL: " << peditor << '\n';
|
||||
else if ((peditor = getenv ("EDITOR")) != NULL)
|
||||
out << " $EDITOR: " << peditor << "\n";
|
||||
out << " $EDITOR: " << peditor << '\n';
|
||||
|
||||
// Theme description, if present.
|
||||
if (rules.has ("theme.description"))
|
||||
out << " Color theme: " << rules.get ("theme.description") << "\n";
|
||||
out << " Color theme: " << rules.get ("theme.description") << '\n';
|
||||
else
|
||||
out << " Color theme: Default theme\n";
|
||||
|
||||
|
@ -196,17 +196,17 @@ int CmdDiagnostics (
|
|||
out << "\n ";
|
||||
out << ' ' << palette.next ().colorize (rightJustifyZero (color, 2));
|
||||
}
|
||||
out << "\n";
|
||||
out << '\n';
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
out << '\n';
|
||||
|
||||
// Display extensions.
|
||||
Directory extDir (rules.get ("temp.db"));
|
||||
extDir += "extensions";
|
||||
|
||||
out << "Extensions\n"
|
||||
<< " Location: " << describeFile (extDir) << "\n";
|
||||
<< " Location: " << describeFile (extDir) << '\n';
|
||||
|
||||
auto exts = extensions.all ();
|
||||
if (exts.size ())
|
||||
|
@ -224,13 +224,13 @@ int CmdDiagnostics (
|
|||
|
||||
out << " ";
|
||||
out.width (longest);
|
||||
out << describeFile (file) << "\n";
|
||||
out << describeFile (file) << '\n';
|
||||
}
|
||||
}
|
||||
else
|
||||
out << " (None)\n";
|
||||
|
||||
out << "\n";
|
||||
out << '\n';
|
||||
std::cout << out.str ();
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -65,12 +65,12 @@ int CmdExtensions (
|
|||
Directory extDir (rules.get ("temp.db"));
|
||||
extDir += "extensions";
|
||||
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Extensions located in:\n"
|
||||
<< " " << extDir._data << "\n"
|
||||
<< "\n"
|
||||
<< " " << extDir._data << '\n'
|
||||
<< '\n'
|
||||
<< t.render ()
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
int CmdHelpUsage ()
|
||||
{
|
||||
// TODO This is going to need formatting.
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Usage: timew [--version]\n"
|
||||
<< " timew continue\n"
|
||||
<< " timew diagnostics\n"
|
||||
|
@ -44,7 +44,7 @@ int CmdHelpUsage ()
|
|||
<< " timew stop [<tag> ...]\n"
|
||||
<< " timew tags\n"
|
||||
<< " timew track <interval> [<tag> ...]\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Interval:\n"
|
||||
<< " [from] <date>\n"
|
||||
<< " [from] <date> to/- <date>\n"
|
||||
|
@ -52,13 +52,13 @@ int CmdHelpUsage ()
|
|||
<< " <duration> before <date>\n"
|
||||
<< " <duration> after <date>\n"
|
||||
<< " <duration>\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Tag:\n"
|
||||
<< " Word\n"
|
||||
<< " 'Single Quoted Words'\n"
|
||||
<< " \"Double Quoted Words\"\n"
|
||||
<< " Escaped\\ Spaces\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// TODO clear
|
||||
// TODO config
|
||||
|
@ -99,109 +99,109 @@ int CmdHelp (const CLI& cli)
|
|||
// Ruler 1 2 3 4 5 6 7 8
|
||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
if (words[0] == "continue")
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Syntax: timew continue\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Resumes tracking the most recently closed interval. For exqample:\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " $ timew track 9am - 5pm tag1 tag2\n"
|
||||
<< " $ timew continue\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "The 'continue' command creates a new interval, starting now, and using the tags\n"
|
||||
<< "'tag1' and 'tag2'.\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "See also 'start', 'stop'.\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// TODO day
|
||||
|
||||
// Ruler 1 2 3 4 5 6 7 8
|
||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
else if (words[0] == "diagnostics")
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Syntax: timew diagnostics\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "This command shows details about your version of Timewarrior, platform, how it\n"
|
||||
<< "was built, compiler features, configuration, file access, extensions and more.\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "The purpose of this command is to help diagnose configuration problems, and\n"
|
||||
<< "provide supplemental information when reporting a problem.\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "See also 'extensions'.\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// Ruler 1 2 3 4 5 6 7 8
|
||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
else if (words[0] == "export")
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Syntax: timew export [<interval>] [<tag> ...]\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Exports all the tracked time in JSON format. Supports filtering. For example:\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " $ timew export from 2016-01-01 for 3wks tag1\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "See also 'import'.\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// Ruler 1 2 3 4 5 6 7 8
|
||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
else if (words[0] == "extensions")
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Syntax: timew extensions\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Displays the directory containing the extension programs, and a table showing\n"
|
||||
<< "each extensions and its status.\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "See also 'diagnostics'.\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// TODO gaps
|
||||
|
||||
// Ruler 1 2 3 4 5 6 7 8
|
||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
else if (words[0] == "help")
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "The help command shows detailed descriptions and examples of commands and the\n"
|
||||
<< "supported hints. For example:\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " $ timew help\n"
|
||||
<< " $ timew help start\n"
|
||||
<< " $ timew help hints\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// Ruler 1 2 3 4 5 6 7 8
|
||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
else if (words[0] == "hints")
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Timewarrior supports hints, which are single-word command line features that\n"
|
||||
<< "start with a colon like this:\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " :week\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Hints serve several purposes. This example is a shortcut for the date range\n"
|
||||
<< "that defines the current week. Other hints, such as:\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " :quiet\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "are ways to control the behavior of Timewarrior, in this case eliminating all\n"
|
||||
<< "forms of feedback, for purposes of automation. The supported hints are:\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " :quiet Turns off all feedback. For automation\n"
|
||||
<< " :debug Runs in debug mode, shows many runtime details\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " :color Force color on, even if not connected to a TTY\n"
|
||||
<< " :nocolor Force color off, even if connected to a TTY\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " :yesterday The 24 hours of the previous day\n"
|
||||
<< " :day The 24 hours of the current day\n"
|
||||
<< " :week This week\n"
|
||||
<< " :month This month\n"
|
||||
<< " :quarter This quarter\n"
|
||||
<< " :year This year\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " :fill Expand time to fill surrounding available gap\n"
|
||||
<< " Only functions when exclusions are provided\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// TODO import
|
||||
// TODO month
|
||||
|
@ -211,57 +211,57 @@ int CmdHelp (const CLI& cli)
|
|||
// Ruler 1 2 3 4 5 6 7 8
|
||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
else if (words[0] == "start")
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Syntax: timew start [<date>] [<tag> ...]\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Begins tracking using the current time, and the specified optional set of tags.\n"
|
||||
<< "If a tag contains multiple words, and therefore contains spaces, use quotes to\n"
|
||||
<< "surround the whole tag. For example, this command specifies two tags ('weekend'\n"
|
||||
<< "and 'Home & Garden'), the second of which requires quotes.\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " $ timew start weekend 'Home & Garden'\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "An optional date may be specified to indicate the intended start to the tracked\n"
|
||||
<< "time:\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " $ time start 8am weekend 'Home & Garden'\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Quotes are harmless if used unecessarily.\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "See also 'continue', 'stop', 'track'.\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// Ruler 1 2 3 4 5 6 7 8
|
||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
else if (words[0] == "stop")
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Syntax: timew stop [<tag> ...]\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Stops tracking time. If tags are specified, then they are no longer tracked.\n"
|
||||
<< "If no tags are specified, all tracking stops. For example:\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " $ timew start tag1 tag2\n"
|
||||
<< " ...\n"
|
||||
<< " $ timew stop tag1\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Initially time is tracked for both 'tag1' and 'tag2', then 'tag1' tracking is\n"
|
||||
<< "stopped, leaving tag2 active. To stop all tracking:\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< " $ timew stop\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "See also 'continue', 'start', 'track'.\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// TODO summary
|
||||
|
||||
// Ruler 1 2 3 4 5 6 7 8
|
||||
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
else if (words[0] == "tags")
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< "Syntax: timew tags\n"
|
||||
<< "\n"
|
||||
<< '\n'
|
||||
<< "Displays all the tags that have been used.\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
// TODO track
|
||||
// TODO undo
|
||||
|
|
|
@ -97,10 +97,10 @@ int CmdReport (
|
|||
|
||||
std::stringstream header;
|
||||
for (auto& name : rules.all ())
|
||||
header << name << ": " << rules.get (name) << "\n";
|
||||
header << name << ": " << rules.get (name) << '\n';
|
||||
|
||||
auto input = header.str ()
|
||||
+ "\n"
|
||||
+ '\n'
|
||||
+ jsonFromIntervals (intervals);
|
||||
|
||||
// Run the extensions.
|
||||
|
@ -109,7 +109,7 @@ int CmdReport (
|
|||
|
||||
// Display the output.
|
||||
for (auto& line : output)
|
||||
std::cout << line << "\n";
|
||||
std::cout << line << '\n';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -63,20 +63,20 @@ int CmdReportDay (
|
|||
|
||||
// TODO Axis, hard-coded.
|
||||
std::string indent = " ";
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< indent
|
||||
<< "0 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11\n";
|
||||
|
||||
// TODO Data, missing.
|
||||
std::cout << "\n"
|
||||
<< "\n";
|
||||
std::cout << '\n'
|
||||
<< '\n';
|
||||
|
||||
// TODO Summary, missing.
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< indent << "Tracked\n"
|
||||
<< indent << "Untracked\n"
|
||||
<< indent << "Total\n"
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -71,14 +71,14 @@ int CmdStop (
|
|||
|
||||
// User feedback.
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << "\n" << intervalSummarize (rules, latest);
|
||||
std::cout << '\n' << intervalSummarize (rules, latest);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string message = "There is no active time tracking.";
|
||||
if (rules.getBoolean ("verbose"))
|
||||
std::cout << message << "\n";
|
||||
std::cout << message << '\n';
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -68,9 +68,9 @@ int CmdTags (Rules& rules, Database& database)
|
|||
t.set (row, 1, rules.has (name) ? rules.get (name) : "-");
|
||||
}
|
||||
|
||||
std::cout << "\n"
|
||||
std::cout << '\n'
|
||||
<< t.render ()
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
std::cout << "No data found.\n";
|
||||
|
|
|
@ -67,21 +67,21 @@ std::string intervalSummarize (const Rules& rules, const Interval& interval)
|
|||
if (interval.range.ended ())
|
||||
{
|
||||
Duration dur (Datetime (interval.range.end) - Datetime (interval.range.start));
|
||||
out << "Recorded " << tags << "\n"
|
||||
<< " Started " << interval.range.start.toISOLocalExtended () << "\n"
|
||||
<< " Ended " << interval.range.end.toISOLocalExtended () << "\n"
|
||||
<< " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << "\n";
|
||||
out << "Recorded " << tags << '\n'
|
||||
<< " Started " << interval.range.start.toISOLocalExtended () << '\n'
|
||||
<< " Ended " << interval.range.end.toISOLocalExtended () << '\n'
|
||||
<< " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << '\n';
|
||||
}
|
||||
|
||||
// Interval open.
|
||||
else
|
||||
{
|
||||
Duration dur (Datetime () - interval.range.start);
|
||||
out << "Tracking " << tags << "\n"
|
||||
<< " Started " << interval.range.start.toISOLocalExtended () << "\n";
|
||||
out << "Tracking " << tags << '\n'
|
||||
<< " Started " << interval.range.start.toISOLocalExtended () << '\n';
|
||||
|
||||
if (dur.toTime_t () > 10)
|
||||
out << " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << "\n";
|
||||
out << " Elapsed " << std::setw (19) << std::setfill (' ') << dur.format () << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ std::string jsonFromIntervals (const std::vector <Interval>& intervals)
|
|||
}
|
||||
|
||||
if (counter)
|
||||
out << "\n";
|
||||
out << '\n';
|
||||
|
||||
out << "]\n";
|
||||
return out.str ();
|
||||
|
|
|
@ -46,7 +46,7 @@ bool lightweightVersionCheck (int argc, const char** argv)
|
|||
{
|
||||
if (argc == 2 && std::string (argv[1]) == "--version")
|
||||
{
|
||||
std::cout << VERSION << "\n";
|
||||
std::cout << VERSION << '\n';
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ int dispatchCommand (
|
|||
|
||||
// Debug output.
|
||||
if (rules.getBoolean ("debug"))
|
||||
std::cout << cli.dump () << "\n";
|
||||
std::cout << cli.dump () << '\n';
|
||||
|
||||
// Dispatch to the right command function.
|
||||
std::string command = cli.getCommand ();
|
||||
|
|
|
@ -13,7 +13,7 @@ int main (int argc, char** argv)
|
|||
std::string token;
|
||||
Lexer::Type type;
|
||||
while (l.token (token, type))
|
||||
std::cout << " token '" << token << "' " << Lexer::typeToString (type) << "\n";
|
||||
std::cout << " token '" << token << "' " << Lexer::typeToString (type) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,21 +85,21 @@ int main (int argc, const char** argv)
|
|||
|
||||
catch (const std::string& error)
|
||||
{
|
||||
std::cerr << error << "\n";
|
||||
std::cerr << error << '\n';
|
||||
status = -1;
|
||||
}
|
||||
|
||||
catch (std::bad_alloc& error)
|
||||
{
|
||||
auto message = std::string ("Memory allocation failed: ") + error.what ();
|
||||
std::cerr << "Error: " << message << "\n";
|
||||
std::cerr << "Error: " << message << '\n';
|
||||
status = -3;
|
||||
}
|
||||
|
||||
catch (...)
|
||||
{
|
||||
auto message = "Unknown problem, please report.";
|
||||
std::cerr << "Error: " << message << "\n";
|
||||
std::cerr << "Error: " << message << '\n';
|
||||
status = -2;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ int main (int, char**)
|
|||
tokens.clear ();
|
||||
while (l3.token (token, type))
|
||||
{
|
||||
std::cout << "# «" << token << "» " << Lexer::typeName (type) << "\n";
|
||||
std::cout << "# «" << token << "» " << Lexer::typeName (type) << '\n';
|
||||
tokens.push_back (std::pair <std::string, Lexer::Type> (token, type));
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ UnitTest::UnitTest (int planned)
|
|||
, _failed (0)
|
||||
, _skipped (0)
|
||||
{
|
||||
std::cout << "1.." << _planned << "\n";
|
||||
std::cout << "1.." << _planned << '\n';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -99,14 +99,14 @@ void UnitTest::plan (int planned)
|
|||
_failed = 0;
|
||||
_skipped = 0;
|
||||
|
||||
std::cout << "1.." << _planned << "\n";
|
||||
std::cout << "1.." << _planned << '\n';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void UnitTest::planMore (int extra)
|
||||
{
|
||||
_planned += extra;
|
||||
std::cout << "1.." << _planned << "\n";
|
||||
std::cout << "1.." << _planned << '\n';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -122,7 +122,7 @@ void UnitTest::ok (bool expression, const std::string& name)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ void UnitTest::ok (bool expression, const std::string& name)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void UnitTest::notok (bool expression, const std::string& name)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ void UnitTest::notok (bool expression, const std::string& name)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ void UnitTest::is (bool actual, bool expected, const std::string& name)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ void UnitTest::is (bool actual, bool expected, const std::string& name)
|
|||
<< expected
|
||||
<< "\n# got: "
|
||||
<< actual
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ void UnitTest::is (size_t actual, size_t expected, const std::string& name)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -219,7 +219,7 @@ void UnitTest::is (size_t actual, size_t expected, const std::string& name)
|
|||
<< expected
|
||||
<< "\n# got: "
|
||||
<< actual
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ void UnitTest::is (int actual, int expected, const std::string& name)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ void UnitTest::is (int actual, int expected, const std::string& name)
|
|||
<< expected
|
||||
<< "\n# got: "
|
||||
<< actual
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ void UnitTest::is (double actual, double expected, const std::string& name)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -279,7 +279,7 @@ void UnitTest::is (double actual, double expected, const std::string& name)
|
|||
<< expected
|
||||
<< "\n# got: "
|
||||
<< actual
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ void UnitTest::is (double actual, double expected, double tolerance, const std::
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -309,7 +309,7 @@ void UnitTest::is (double actual, double expected, double tolerance, const std::
|
|||
<< expected
|
||||
<< "\n# got: "
|
||||
<< actual
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ void UnitTest::is (unsigned char actual, unsigned char expected, const std::stri
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -339,7 +339,7 @@ void UnitTest::is (unsigned char actual, unsigned char expected, const std::stri
|
|||
<< expected
|
||||
<< "\n# got: "
|
||||
<< actual
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ void UnitTest::is (
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -392,7 +392,7 @@ void UnitTest::is (
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< name
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -418,7 +418,7 @@ void UnitTest::diag (const std::string& text)
|
|||
auto end = text.find_last_not_of (" \t\n\r\f");
|
||||
if (start != std::string::npos &&
|
||||
end != std::string::npos)
|
||||
std::cout << "# " << text.substr (start, end - start + 1) << "\n";
|
||||
std::cout << "# " << text.substr (start, end - start + 1) << '\n';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -431,7 +431,7 @@ void UnitTest::pass (const std::string& text)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< text
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -444,7 +444,7 @@ void UnitTest::fail (const std::string& text)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< text
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -457,7 +457,7 @@ void UnitTest::skip (const std::string& text)
|
|||
<< _counter
|
||||
<< " - "
|
||||
<< text
|
||||
<< "\n";
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue