mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-27 12:16:25 +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
|
@ -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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue