Cleanup: Don't use string literals when character literals are needed

This commit is contained in:
Paul Beckingham 2016-10-14 22:27:34 -04:00
parent 5403675100
commit 95f4989f77
58 changed files with 372 additions and 374 deletions

View file

@ -213,7 +213,7 @@ const std::string A2::dump () const
else tags += "\033[32m" + tag + "\033[0m "; else tags += "\033[32m" + tag + "\033[0m ";
} }
return output + " " + atts + tags; return output + ' ' + atts + tags;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -632,7 +632,7 @@ void CLI2::prepareFilter ()
if (a.hasTag ("FILTER")) if (a.hasTag ("FILTER"))
{ {
if (combined != "") if (combined != "")
combined += " "; combined += ' ';
combined += a.attribute ("raw"); combined += a.attribute ("raw");
} }
@ -657,7 +657,7 @@ const std::vector <std::string> CLI2::getWords ()
Color colorOrigArgs ("gray10 on gray4"); Color colorOrigArgs ("gray10 on gray4");
std::string message = " "; std::string message = " ";
for (const auto& word : words) for (const auto& word : words)
message += colorOrigArgs.colorize (word) + " "; message += colorOrigArgs.colorize (word) + ' ';
context.debug ("CLI2::getWords" + message); context.debug ("CLI2::getWords" + message);
} }
@ -737,13 +737,13 @@ const std::string CLI2::dump (const std::string& title) const
out << colorFilter.colorize (i->attribute ("raw")); out << colorFilter.colorize (i->attribute ("raw"));
} }
out << "\n"; out << '\n';
if (_args.size ()) if (_args.size ())
{ {
out << " _args\n"; out << " _args\n";
for (const auto& a : _args) for (const auto& a : _args)
out << " " << a.dump () << "\n"; out << " " << a.dump () << '\n';
} }
if (_id_ranges.size ()) if (_id_ranges.size ())
@ -752,21 +752,21 @@ const std::string CLI2::dump (const std::string& title) const
for (const auto& range : _id_ranges) for (const auto& range : _id_ranges)
{ {
if (range.first != range.second) if (range.first != range.second)
out << colorArgs.colorize (range.first + "-" + range.second) << " "; out << colorArgs.colorize (range.first + "-" + range.second) << ' ';
else else
out << colorArgs.colorize (range.first) << " "; out << colorArgs.colorize (range.first) << ' ';
} }
out << "\n"; out << '\n';
} }
if (_uuid_list.size ()) if (_uuid_list.size ())
{ {
out << " _uuid_list\n "; out << " _uuid_list\n ";
for (const auto& uuid : _uuid_list) for (const auto& uuid : _uuid_list)
out << colorArgs.colorize (uuid) << " "; out << colorArgs.colorize (uuid) << ' ';
out << "\n"; out << '\n';
} }
return out.str (); return out.str ();
@ -1242,7 +1242,7 @@ void CLI2::desugarFilterAttributes ()
std::vector <A2> values = lexExpression (value); std::vector <A2> values = lexExpression (value);
if (context.config.getInteger ("debug.parser") >= 2) if (context.config.getInteger ("debug.parser") >= 2)
{ {
context.debug ("CLI2::lexExpression " + name + ":" + value); context.debug ("CLI2::lexExpression " + name + ':' + value);
for (auto& v : values) for (auto& v : values)
context.debug (" " + v.dump ()); context.debug (" " + v.dump ());
context.debug (" "); context.debug (" ");

View file

@ -308,7 +308,7 @@ Color::operator std::string () const
if (_value & _COLOR_BRIGHT) if (_value & _COLOR_BRIGHT)
description += std::string (description.length () ? " " : "") + "bright"; description += std::string (description.length () ? " " : "") + "bright";
description += " " + bg (); description += ' ' + bg ();
} }
return description; return description;

View file

@ -489,7 +489,7 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data)
std::stringstream contents; std::stringstream contents;
contents << "# [Created by " contents << "# [Created by "
<< PACKAGE_STRING << PACKAGE_STRING
<< " " << ' '
<< now.toString ("m/d/Y H:N:S") << now.toString ("m/d/Y H:N:S")
<< "]\n" << "]\n"
<< _defaults.substr (0, loc + 14) << _defaults.substr (0, loc + 14)
@ -509,7 +509,7 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data)
<< "#include " << TASK_RCDIR << "/solarized-dark-256.theme\n" << "#include " << TASK_RCDIR << "/solarized-dark-256.theme\n"
<< "#include " << TASK_RCDIR << "/solarized-light-256.theme\n" << "#include " << TASK_RCDIR << "/solarized-light-256.theme\n"
<< "#include " << TASK_RCDIR << "/no-color.theme\n" << "#include " << TASK_RCDIR << "/no-color.theme\n"
<< "\n"; << '\n';
// Write out the new file. // Write out the new file.
if (! File::write (rc, contents.str ())) if (! File::write (rc, contents.str ()))

View file

@ -273,9 +273,9 @@ int Context::initialize (int argc, const char** argv)
{ {
for (auto& d : debugMessages) for (auto& d : debugMessages)
if (color ()) if (color ())
std::cerr << colorizeDebug (d) << "\n"; std::cerr << colorizeDebug (d) << '\n';
else else
std::cerr << d << "\n"; std::cerr << d << '\n';
} }
// Dump all headers, controlled by 'header' verbosity token. // Dump all headers, controlled by 'header' verbosity token.
@ -283,9 +283,9 @@ int Context::initialize (int argc, const char** argv)
{ {
for (auto& h : headers) for (auto& h : headers)
if (color ()) if (color ())
std::cerr << colorizeHeader (h) << "\n"; std::cerr << colorizeHeader (h) << '\n';
else else
std::cerr << h << "\n"; std::cerr << h << '\n';
} }
// Dump all footnotes, controlled by 'footnote' verbosity token. // Dump all footnotes, controlled by 'footnote' verbosity token.
@ -293,18 +293,18 @@ int Context::initialize (int argc, const char** argv)
{ {
for (auto& f : footnotes) for (auto& f : footnotes)
if (color ()) if (color ())
std::cerr << colorizeFootnote (f) << "\n"; std::cerr << colorizeFootnote (f) << '\n';
else else
std::cerr << f << "\n"; std::cerr << f << '\n';
} }
// Dump all errors, non-maskable. // Dump all errors, non-maskable.
// Colorized as footnotes. // Colorized as footnotes.
for (auto& e : errors) for (auto& e : errors)
if (color ()) if (color ())
std::cerr << colorizeFootnote (e) << "\n"; std::cerr << colorizeFootnote (e) << '\n';
else else
std::cerr << e << "\n"; std::cerr << e << '\n';
} }
timer_init.stop (); timer_init.stop ();
@ -329,13 +329,13 @@ int Context::run ()
std::stringstream s; std::stringstream s;
s << "Perf " s << "Perf "
<< PACKAGE_STRING << PACKAGE_STRING
<< " " << ' '
#ifdef HAVE_COMMIT #ifdef HAVE_COMMIT
<< COMMIT << COMMIT
#else #else
<< "-" << '-'
#endif #endif
<< " " << ' '
<< ISO8601d ().toISO () << ISO8601d ().toISO ()
<< " init:" << timer_init.total () << " init:" << timer_init.total ()
@ -356,7 +356,7 @@ int Context::run ()
timer_render.total () - timer_render.total () -
timer_hooks.total () timer_hooks.total ()
<< " total:" << timer_total.total () << " total:" << timer_total.total ()
<< "\n"; << '\n';
debug (s.str ()); debug (s.str ());
} }
@ -383,9 +383,9 @@ int Context::run ()
{ {
for (auto& d : debugMessages) for (auto& d : debugMessages)
if (color ()) if (color ())
std::cerr << colorizeDebug (d) << "\n"; std::cerr << colorizeDebug (d) << '\n';
else else
std::cerr << d << "\n"; std::cerr << d << '\n';
} }
// Dump all headers, controlled by 'header' verbosity token. // Dump all headers, controlled by 'header' verbosity token.
@ -393,9 +393,9 @@ int Context::run ()
{ {
for (auto& h : headers) for (auto& h : headers)
if (color ()) if (color ())
std::cerr << colorizeHeader (h) << "\n"; std::cerr << colorizeHeader (h) << '\n';
else else
std::cerr << h << "\n"; std::cerr << h << '\n';
} }
// Dump the report output. // Dump the report output.
@ -406,18 +406,18 @@ int Context::run ()
{ {
for (auto& f : footnotes) for (auto& f : footnotes)
if (color ()) if (color ())
std::cerr << colorizeFootnote (f) << "\n"; std::cerr << colorizeFootnote (f) << '\n';
else else
std::cerr << f << "\n"; std::cerr << f << '\n';
} }
// Dump all errors, non-maskable. // Dump all errors, non-maskable.
// Colorized as footnotes. // Colorized as footnotes.
for (auto& e : errors) for (auto& e : errors)
if (color ()) if (color ())
std::cerr << colorizeError (e) << "\n"; std::cerr << colorizeError (e) << '\n';
else else
std::cerr << e << "\n"; std::cerr << e << '\n';
return rc; return rc;
} }
@ -819,7 +819,7 @@ void Context::updateXtermTitle ()
title += a->attribute ("raw"); title += a->attribute ("raw");
} }
std::cout << "]0;task " << command << " " << title << ""; std::cout << "]0;task " << command << ' ' << title << "";
} }
} }

View file

@ -90,7 +90,7 @@ bool getDOM (const std::string& name, Variant& value)
for (auto& arg : context.cli2._original_args) for (auto& arg : context.cli2._original_args)
{ {
if (commandLine != "") if (commandLine != "")
commandLine += " "; commandLine += ' ';
commandLine += arg.attribute("raw"); commandLine += arg.attribute("raw");
} }

View file

@ -56,7 +56,7 @@ static int verify_certificate_callback (gnutls_session_t);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static void gnutls_log_function (int level, const char* message) static void gnutls_log_function (int level, const char* message)
{ {
std::cout << "c: " << level << " " << message; std::cout << "c: " << level << ' ' << message;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -2144,12 +2144,12 @@ void Task::modify (modType type, bool text_required /* = false */)
case modPrepend: case modPrepend:
context.debug (label + "description <-- '" + text + "' + description"); context.debug (label + "description <-- '" + text + "' + description");
set ("description", text + " " + get ("description")); set ("description", text + ' ' + get ("description"));
break; break;
case modAppend: case modAppend:
context.debug (label + "description <-- description + '" + text + "'"); context.debug (label + "description <-- description + '" + text + "'");
set ("description", get ("description") + " " + text); set ("description", get ("description") + ' ' + text);
break; break;
case modAnnotate: case modAnnotate:

View file

@ -55,7 +55,7 @@ Timer::~Timer ()
std::stringstream s; std::stringstream s;
s << "Timer " s << "Timer "
<< _description << _description
<< " " << ' '
<< std::setprecision (6) << std::setprecision (6)
<< std::fixed << std::fixed
<< _total / 1000000.0 << _total / 1000000.0

View file

@ -57,7 +57,7 @@ int main (int argc, char** argv)
try try
{ {
bool infix = true; bool infix {true};
// Add a source for constants. // Add a source for constants.
Eval e; Eval e;
@ -69,29 +69,29 @@ int main (int argc, char** argv)
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
if (!strcmp (argv[i], "-h") || ! strcmp (argv[i], "--help")) if (!strcmp (argv[i], "-h") || ! strcmp (argv[i], "--help"))
{ {
std::cout << "\n" std::cout << '\n'
<< "Usage: " << argv[0] << " [options] '<expression>'\n" << "Usage: " << argv[0] << " [options] '<expression>'\n"
<< "\n" << '\n'
<< "Options:\n" << "Options:\n"
<< " -h|--help Display this usage\n" << " -h|--help Display this usage\n"
<< " -d|--debug Debug mode\n" << " -d|--debug Debug mode\n"
<< " -i|--infix Infix expression (default)\n" << " -i|--infix Infix expression (default)\n"
<< " -p|--postfix Postfix expression\n" << " -p|--postfix Postfix expression\n"
<< "\n"; << '\n';
exit (1); exit (1);
} }
else if (!strcmp (argv[i], "-v") || !strcmp (argv[i], "--version")) else if (!strcmp (argv[i], "-v") || !strcmp (argv[i], "--version"))
{ {
std::cout << "\n" std::cout << '\n'
<< format (STRING_CMD_VERSION_BUILT, "calc", VERSION) << format (STRING_CMD_VERSION_BUILT, "calc", VERSION)
<< osName () << osName ()
<< "\n" << '\n'
<< STRING_CMD_VERSION_COPY << STRING_CMD_VERSION_COPY
<< "\n" << '\n'
<< "\n" << '\n'
<< STRING_CMD_VERSION_MIT << STRING_CMD_VERSION_MIT
<< "\n" << '\n'
<< "\n"; << '\n';
exit (1); exit (1);
} }
@ -102,7 +102,7 @@ int main (int argc, char** argv)
else if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "--postfix")) else if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "--postfix"))
infix = false; infix = false;
else else
expression += std::string (argv[i]) + " "; expression += std::string (argv[i]) + ' ';
Variant result; Variant result;
if (infix) if (infix)
@ -112,16 +112,16 @@ int main (int argc, char** argv)
// Show any debug output. // Show any debug output.
for (auto& i : context.debugMessages) for (auto& i : context.debugMessages)
std::cout << i << "\n"; std::cout << i << '\n';
// Show the result in string form. // Show the result in string form.
std::cout << (std::string) result std::cout << (std::string) result
<< "\n"; << '\n';
} }
catch (const std::string& error) catch (const std::string& error)
{ {
std::cerr << error << "\n"; std::cerr << error << '\n';
status = -1; status = -1;
} }

View file

@ -182,7 +182,7 @@ void ColumnDescription::render (
for (const auto& i : annos) for (const auto& i : annos)
{ {
ISO8601d dt (strtol (i.first.substr (11).c_str (), NULL, 10)); ISO8601d dt (strtol (i.first.substr (11).c_str (), NULL, 10));
description += "\n" + std::string (_indent, ' ') + dt.toString (_dateformat) + " " + i.second; description += '\n' + std::string (_indent, ' ') + dt.toString (_dateformat) + ' ' + i.second;
} }
} }
@ -213,7 +213,7 @@ void ColumnDescription::render (
for (const auto& i : annos) for (const auto& i : annos)
{ {
ISO8601d dt (strtol (i.first.substr (11).c_str (), NULL, 10)); ISO8601d dt (strtol (i.first.substr (11).c_str (), NULL, 10));
description += " " + dt.toString (_dateformat) + " " + i.second; description += ' ' + dt.toString (_dateformat) + ' ' + i.second;
} }
} }

View file

@ -63,19 +63,19 @@ int CmdAdd::execute (std::string& output)
if (context.verbose ("new-id") && if (context.verbose ("new-id") &&
(status == Task::pending || (status == Task::pending ||
status == Task::waiting)) status == Task::waiting))
output += format (STRING_CMD_ADD_FEEDBACK, task.id) + "\n"; output += format (STRING_CMD_ADD_FEEDBACK, task.id) + '\n';
else if (context.verbose ("new-id") && else if (context.verbose ("new-id") &&
status == Task::recurring) status == Task::recurring)
output += format (STRING_CMD_ADD_RECUR, task.id) + "\n"; output += format (STRING_CMD_ADD_RECUR, task.id) + '\n';
else if (context.verbose ("new-uuid") && else if (context.verbose ("new-uuid") &&
status != Task::recurring) status != Task::recurring)
output += format (STRING_CMD_ADD_FEEDBACK, task.get ("uuid")) + "\n"; output += format (STRING_CMD_ADD_FEEDBACK, task.get ("uuid")) + '\n';
else if (context.verbose ("new-uuid") && else if (context.verbose ("new-uuid") &&
status == Task::recurring) status == Task::recurring)
output += format (STRING_CMD_ADD_RECUR, task.get ("uuid")) + "\n"; output += format (STRING_CMD_ADD_RECUR, task.get ("uuid")) + '\n';
if (context.verbose ("project")) if (context.verbose ("project"))
context.footnote (onProjectChange (task)); context.footnote (onProjectChange (task));

View file

@ -53,7 +53,7 @@ int CmdCompletionAliases::execute (std::string& output)
{ {
for (auto& alias : context.config) for (auto& alias : context.config)
if (alias.first.substr (0, 6) == "alias.") if (alias.first.substr (0, 6) == "alias.")
output += alias.first.substr (6) + "\n"; output += alias.first.substr (6) + '\n';
return 0; return 0;
} }

View file

@ -118,7 +118,7 @@ int CmdAnnotate::execute (std::string&)
} }
else else
{ {
std::cout << STRING_CMD_ANNO_NO << "\n"; std::cout << STRING_CMD_ANNO_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;

View file

@ -118,7 +118,7 @@ int CmdAppend::execute (std::string&)
} }
else else
{ {
std::cout << STRING_CMD_APPEND_NO << "\n"; std::cout << STRING_CMD_APPEND_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;

View file

@ -60,7 +60,7 @@ int CmdZshAttributes::execute (std::string& output)
std::stringstream out; std::stringstream out;
for (auto& col : columns) for (auto& col : columns)
out << col << ":" << col << "\n"; out << col << ":" << col << '\n';
output = out.str (); output = out.str ();
return 0; return 0;

View file

@ -405,13 +405,13 @@ std::string Chart::render ()
if (_graph_height < 5 || // a 4-line graph is essentially unreadable. if (_graph_height < 5 || // a 4-line graph is essentially unreadable.
_graph_width < 2) // A single-bar graph is useless. _graph_width < 2) // A single-bar graph is useless.
{ {
return std::string (STRING_CMD_BURN_TOO_SMALL) + "\n"; return std::string (STRING_CMD_BURN_TOO_SMALL) + '\n';
} }
else if (_graph_height > 1000 || // each line is a string allloc else if (_graph_height > 1000 || // each line is a string allloc
_graph_width > 1000) _graph_width > 1000)
{ {
return std::string (STRING_CMD_BURN_TOO_LARGE) + "\n"; return std::string (STRING_CMD_BURN_TOO_LARGE) + '\n';
} }
if (_max_value == 0) if (_max_value == 0)
@ -420,7 +420,7 @@ std::string Chart::render ()
// Create a grid, folded into a string. // Create a grid, folded into a string.
_grid = ""; _grid = "";
for (int i = 0; i < _height; ++i) for (int i = 0; i < _height; ++i)
_grid += std::string (_width, ' ') + "\n"; _grid += std::string (_width, ' ') + '\n';
// Title. // Title.
std::string full_title; std::string full_title;
@ -437,7 +437,7 @@ std::string Chart::render ()
{ {
if (full_title.length () + 1 + _title.length () < (unsigned) _width) if (full_title.length () + 1 + _title.length () < (unsigned) _width)
{ {
full_title += " " + _title; full_title += ' ' + _title;
_grid.replace (LOC (0, (_width - full_title.length ()) / 2), full_title.length (), full_title); _grid.replace (LOC (0, (_width - full_title.length ()) / 2), full_title.length (), full_title);
} }
else else
@ -494,7 +494,7 @@ std::string Chart::render ()
_grid.replace (LOC (_height - 5, _max_label + 3 + ((_actual_bars - bar._offset - 1) * 3)), bar._minor_label.length (), bar._minor_label); _grid.replace (LOC (_height - 5, _max_label + 3 + ((_actual_bars - bar._offset - 1) * 3)), bar._minor_label.length (), bar._minor_label);
if (_major_label != bar._major_label) if (_major_label != bar._major_label)
_grid.replace (LOC (_height - 4, _max_label + 2 + ((_actual_bars - bar._offset - 1) * 3)), bar._major_label.length (), " " + bar._major_label); _grid.replace (LOC (_height - 4, _max_label + 2 + ((_actual_bars - bar._offset - 1) * 3)), bar._major_label.length (), ' ' + bar._major_label);
_major_label = bar._major_label; _major_label = bar._major_label;
} }

View file

@ -69,7 +69,7 @@ int CmdCalc::execute (std::string& output)
// Compile all the args into one expression. // Compile all the args into one expression.
std::string expression; std::string expression;
for (auto& word : context.cli2.getWords ()) for (auto& word : context.cli2.getWords ())
expression += word + " "; expression += word + ' ';
// Evaluate according to preference. // Evaluate according to preference.
Variant result; Variant result;
@ -78,7 +78,7 @@ int CmdCalc::execute (std::string& output)
else else
e.evaluatePostfixExpression (expression, result); e.evaluatePostfixExpression (expression, result);
output = (std::string) result + "\n"; output = (std::string) result + '\n';
return 0; return 0;
} }

View file

@ -225,7 +225,7 @@ int CmdCalendar::execute (std::string& output)
int details_mFrom = mFrom; int details_mFrom = mFrom;
std::stringstream out; std::stringstream out;
out << "\n"; out << '\n';
while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo)) while (yFrom < yTo || (yFrom == yTo && mFrom <= mTo))
{ {
@ -269,10 +269,10 @@ int CmdCalendar::execute (std::string& output)
} }
} }
out << "\n" out << '\n'
<< optionalBlankLine () << optionalBlankLine ()
<< renderMonths (mFrom, yFrom, today, tasks, monthsPerLine) << renderMonths (mFrom, yFrom, today, tasks, monthsPerLine)
<< "\n"; << '\n';
mFrom += monthsPerLine; mFrom += monthsPerLine;
if (mFrom > 12) if (mFrom > 12)
@ -306,9 +306,9 @@ int CmdCalendar::execute (std::string& output)
<< color_holiday.colorize ("holiday") << color_holiday.colorize ("holiday")
<< ", " << ", "
<< color_weeknumber.colorize ("weeknumber") << color_weeknumber.colorize ("weeknumber")
<< "." << '.'
<< optionalBlankLine () << optionalBlankLine ()
<< "\n"; << '\n';
if (context.config.get ("calendar.details") == "full" || context.config.get ("calendar.holidays") == "full") if (context.config.get ("calendar.details") == "full" || context.config.get ("calendar.holidays") == "full")
{ {
@ -409,7 +409,7 @@ int CmdCalendar::execute (std::string& output)
out << optionalBlankLine () out << optionalBlankLine ()
<< holTable.render () << holTable.render ()
<< "\n"; << '\n';
} }
} }

View file

@ -71,7 +71,7 @@ int CmdColor::execute (std::string& output)
// use. // use.
if (legend) if (legend)
{ {
out << "\n" << STRING_CMD_COLOR_HERE << "\n"; out << '\n' << STRING_CMD_COLOR_HERE << '\n';
ViewText view; ViewText view;
view.width (context.getWidth ()); view.width (context.getWidth ());
@ -94,7 +94,7 @@ int CmdColor::execute (std::string& output)
} }
out << view.render () out << view.render ()
<< "\n"; << '\n';
} }
// If there is something in the description, then assume that is a color, // If there is something in the description, then assume that is a color,
@ -112,26 +112,26 @@ int CmdColor::execute (std::string& output)
for (auto word = words.begin (); word != words.end (); ++word) for (auto word = words.begin (); word != words.end (); ++word)
{ {
if (word != words.begin ()) if (word != words.begin ())
swatch += " "; swatch += ' ';
swatch += *word; swatch += *word;
} }
Color sample (swatch); Color sample (swatch);
out << "\n" out << '\n'
<< STRING_CMD_COLOR_EXPLANATION << "\n" << STRING_CMD_COLOR_EXPLANATION << '\n'
<< "\n\n" << "\n\n"
<< STRING_CMD_COLOR_16 << "\n" << STRING_CMD_COLOR_16 << '\n'
<< " " << one.colorize ("task color black on bright yellow") << "\n" << " " << one.colorize ("task color black on bright yellow") << '\n'
<< " " << two.colorize ("task color underline cyan on bright blue") << "\n" << " " << two.colorize ("task color underline cyan on bright blue") << '\n'
<< "\n" << '\n'
<< STRING_CMD_COLOR_256 << "\n" << STRING_CMD_COLOR_256 << '\n'
<< " " << three.colorize ("task color color214 on color202") << "\n" << " " << three.colorize ("task color color214 on color202") << '\n'
<< " " << four.colorize ("task color rgb150 on rgb020") << "\n" << " " << four.colorize ("task color rgb150 on rgb020") << '\n'
<< " " << five.colorize ("task color underline grey10 on grey3") << "\n" << " " << five.colorize ("task color underline grey10 on grey3") << '\n'
<< " " << six.colorize ("task color red on color173") << "\n" << " " << six.colorize ("task color red on color173") << '\n'
<< "\n" << '\n'
<< STRING_CMD_COLOR_YOURS << "\n\n" << STRING_CMD_COLOR_YOURS << "\n\n"
<< " " << sample.colorize ("task color " + swatch) << "\n\n"; << " " << sample.colorize ("task color " + swatch) << "\n\n";
} }
@ -139,41 +139,41 @@ int CmdColor::execute (std::string& output)
// Show all supported colors. Possibly show some unsupported ones too. // Show all supported colors. Possibly show some unsupported ones too.
else else
{ {
out << "\n" out << '\n'
<< STRING_CMD_COLOR_BASIC << STRING_CMD_COLOR_BASIC
<< "\n" << '\n'
<< " " << Color::colorize (" black ", "black") << ' ' << Color::colorize (" black ", "black")
<< " " << Color::colorize (" red ", "red") << ' ' << Color::colorize (" red ", "red")
<< " " << Color::colorize (" blue ", "blue") << ' ' << Color::colorize (" blue ", "blue")
<< " " << Color::colorize (" green ", "green") << ' ' << Color::colorize (" green ", "green")
<< " " << Color::colorize (" magenta ", "magenta") << ' ' << Color::colorize (" magenta ", "magenta")
<< " " << Color::colorize (" cyan ", "cyan") << ' ' << Color::colorize (" cyan ", "cyan")
<< " " << Color::colorize (" yellow ", "yellow") << ' ' << Color::colorize (" yellow ", "yellow")
<< " " << Color::colorize (" white ", "white") << ' ' << Color::colorize (" white ", "white")
<< "\n" << '\n'
<< " " << Color::colorize (" black ", "white on black") << ' ' << Color::colorize (" black ", "white on black")
<< " " << Color::colorize (" red ", "white on red") << ' ' << Color::colorize (" red ", "white on red")
<< " " << Color::colorize (" blue ", "white on blue") << ' ' << Color::colorize (" blue ", "white on blue")
<< " " << Color::colorize (" green ", "black on green") << ' ' << Color::colorize (" green ", "black on green")
<< " " << Color::colorize (" magenta ", "black on magenta") << ' ' << Color::colorize (" magenta ", "black on magenta")
<< " " << Color::colorize (" cyan ", "black on cyan") << ' ' << Color::colorize (" cyan ", "black on cyan")
<< " " << Color::colorize (" yellow ", "black on yellow") << ' ' << Color::colorize (" yellow ", "black on yellow")
<< " " << Color::colorize (" white ", "black on white") << ' ' << Color::colorize (" white ", "black on white")
<< "\n\n"; << "\n\n";
out << STRING_CMD_COLOR_EFFECTS out << STRING_CMD_COLOR_EFFECTS
<< "\n" << '\n'
<< " " << Color::colorize (" red ", "red") << ' ' << Color::colorize (" red ", "red")
<< " " << Color::colorize (" bold red ", "bold red") << ' ' << Color::colorize (" bold red ", "bold red")
<< " " << Color::colorize (" underline on blue ", "underline on blue") << ' ' << Color::colorize (" underline on blue ", "underline on blue")
<< " " << Color::colorize (" on green ", "black on green") << ' ' << Color::colorize (" on green ", "black on green")
<< " " << Color::colorize (" on bright green ", "black on bright green") << ' ' << Color::colorize (" on bright green ", "black on bright green")
<< " " << Color::colorize (" inverse ", "inverse") << ' ' << Color::colorize (" inverse ", "inverse")
<< "\n\n"; << "\n\n";
// 16 system colors. // 16 system colors.
out << "color0 - color15" out << "color0 - color15"
<< "\n" << '\n'
<< " 0 1 2 . . .\n"; << " 0 1 2 . . .\n";
for (int r = 0; r < 2; ++r) for (int r = 0; r < 2; ++r)
{ {
@ -185,7 +185,7 @@ int CmdColor::execute (std::string& output)
out << Color::colorize (" ", s.str ()); out << Color::colorize (" ", s.str ());
} }
out << "\n"; out << '\n';
} }
out << " . . . 15\n\n"; out << " . . . 15\n\n";
@ -200,21 +200,21 @@ int CmdColor::execute (std::string& output)
<< Color::colorize ("5", "bold green") << Color::colorize ("5", "bold green")
<< Color::colorize ("5", "bold blue") << Color::colorize ("5", "bold blue")
<< " (also color16 - color231)" << " (also color16 - color231)"
<< "\n" << '\n'
<< " " << Color::colorize ("0 " << " " << Color::colorize ("0 "
"1 " "1 "
"2 " "2 "
"3 " "3 "
"4 " "4 "
"5", "bold red") "5", "bold red")
<< "\n" << '\n'
<< " " << Color::colorize ("0 1 2 3 4 5 " << " " << Color::colorize ("0 1 2 3 4 5 "
"0 1 2 3 4 5 " "0 1 2 3 4 5 "
"0 1 2 3 4 5 " "0 1 2 3 4 5 "
"0 1 2 3 4 5 " "0 1 2 3 4 5 "
"0 1 2 3 4 5 " "0 1 2 3 4 5 "
"0 1 2 3 4 5", "bold blue") "0 1 2 3 4 5", "bold blue")
<< "\n"; << '\n';
char label [12]; char label [12];
for (int g = 0; g < 6; ++g) for (int g = 0; g < 6; ++g)
@ -230,13 +230,13 @@ int CmdColor::execute (std::string& output)
out << Color::colorize (" ", s.str ()); out << Color::colorize (" ", s.str ());
} }
out << " "; out << ' ';
} }
out << "\n"; out << '\n';
} }
out << "\n"; out << '\n';
// Grey ramp. // Grey ramp.
out << STRING_CMD_COLOR_RAMP out << STRING_CMD_COLOR_RAMP
@ -257,7 +257,7 @@ int CmdColor::execute (std::string& output)
} }
else else
{ {
out << STRING_CMD_COLOR_OFF << "\n"; out << STRING_CMD_COLOR_OFF << '\n';
rc = 1; rc = 1;
} }

View file

@ -119,9 +119,9 @@ int CmdColumns::execute (std::string& output)
output = optionalBlankLine () output = optionalBlankLine ()
+ formats.render () + formats.render ()
+ "\n" + '\n'
+ STRING_CMD_COLUMNS_NOTE + STRING_CMD_COLUMNS_NOTE
+ "\n"; + '\n';
return 0; return 0;
} }
@ -154,7 +154,7 @@ int CmdCompletionColumns::execute (std::string& output)
// Render only the column names. // Render only the column names.
for (auto& name : names) for (auto& name : names)
output += name + "\n"; output += name + '\n';
return 0; return 0;
} }

View file

@ -119,7 +119,7 @@ int CmdCommands::execute (std::string& output)
output = optionalBlankLine () output = optionalBlankLine ()
+ view.render () + view.render ()
+ optionalBlankLine () + optionalBlankLine ()
+ "\n"; + '\n';
return 0; return 0;
} }
@ -154,7 +154,7 @@ int CmdCompletionCommands::execute (std::string& output)
std::stringstream out; std::stringstream out;
for (auto& c : commands) for (auto& c : commands)
out << c << "\n"; out << c << '\n';
output = out.str (); output = out.str ();
return 0; return 0;
@ -226,7 +226,7 @@ int CmdZshCommands::execute (std::string& output)
for (auto& zc : commands) for (auto& zc : commands)
out << zc._command << ":" out << zc._command << ":"
<< Command::categoryNames.at (zc._category) << ":" << Command::categoryNames.at (zc._category) << ":"
<< zc._description << "\n"; << zc._description << '\n';
output = out.str (); output = out.str ();
return 0; return 0;

View file

@ -77,7 +77,7 @@ bool CmdConfig::setConfigVariable (std::string name, std::string value, bool con
confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value))) confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value)))
{ {
if (comment != std::string::npos) if (comment != std::string::npos)
line = name + "=" + json::encode (value) + " " + line.substr (comment); line = name + "=" + json::encode (value) + ' ' + line.substr (comment);
else else
line = name + "=" + json::encode (value); line = name + "=" + json::encode (value);
@ -178,7 +178,7 @@ int CmdConfig::execute (std::string& output)
for (unsigned int i = 1; i < words.size (); ++i) for (unsigned int i = 1; i < words.size (); ++i)
{ {
if (i > 1) if (i > 1)
value += " "; value += ' ';
value += words[i]; value += words[i];
} }
@ -214,10 +214,10 @@ int CmdConfig::execute (std::string& output)
{ {
out << format (STRING_CMD_CONFIG_FILE_MOD, out << format (STRING_CMD_CONFIG_FILE_MOD,
context.config._original_file._data) context.config._original_file._data)
<< "\n"; << '\n';
} }
else else
out << STRING_CMD_CONFIG_NO_CHANGE << "\n"; out << STRING_CMD_CONFIG_NO_CHANGE << '\n';
} }
else else
throw std::string (STRING_CMD_CONFIG_NO_NAME); throw std::string (STRING_CMD_CONFIG_NO_NAME);
@ -254,7 +254,7 @@ int CmdCompletionConfig::execute (std::string& output)
std::sort (configs.begin (), configs.end ()); std::sort (configs.begin (), configs.end ());
for (auto& config : configs) for (auto& config : configs)
output += config + "\n"; output += config + '\n';
return 0; return 0;
} }

View file

@ -94,7 +94,7 @@ std::string CmdContext::joinWords (const std::vector <std::string>& words, unsig
for (unsigned int i = from; i < to; ++i) for (unsigned int i = from; i < to; ++i)
{ {
if (i > from) if (i > from)
value += " "; value += ' ';
value += words[i]; value += words[i];
} }
@ -163,7 +163,7 @@ void CmdContext::defineContext (const std::vector <std::string>& words, std::str
if (!success) if (!success)
throw format (STRING_CMD_CONTEXT_DEF_FAIL, words[1]); throw format (STRING_CMD_CONTEXT_DEF_FAIL, words[1]);
out << format (STRING_CMD_CONTEXT_DEF_SUCC, words[1]) << "\n"; out << format (STRING_CMD_CONTEXT_DEF_SUCC, words[1]) << '\n';
} }
else else
throw std::string (STRING_CMD_CONTEXT_DEF_USAG); throw std::string (STRING_CMD_CONTEXT_DEF_USAG);
@ -197,7 +197,7 @@ void CmdContext::deleteContext (const std::vector <std::string>& words, std::str
if (rc != 0) if (rc != 0)
throw format (STRING_CMD_CONTEXT_DEL_FAIL, words[1]); throw format (STRING_CMD_CONTEXT_DEL_FAIL, words[1]);
out << format (STRING_CMD_CONTEXT_DEL_SUCC, words[1]) << "\n"; out << format (STRING_CMD_CONTEXT_DEL_SUCC, words[1]) << '\n';
} }
else else
throw std::string(STRING_CMD_CONTEXT_DEL_USAG); throw std::string(STRING_CMD_CONTEXT_DEL_USAG);
@ -279,7 +279,7 @@ void CmdContext::setContext (const std::vector <std::string>& words, std::string
if (! success) if (! success)
throw format (STRING_CMD_CONTEXT_SET_FAIL, value); throw format (STRING_CMD_CONTEXT_SET_FAIL, value);
out << format (STRING_CMD_CONTEXT_SET_SUCC, value) << "\n"; out << format (STRING_CMD_CONTEXT_SET_SUCC, value) << '\n';
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -295,11 +295,11 @@ void CmdContext::showContext (std::stringstream& out)
auto currentContext = context.config.get ("context"); auto currentContext = context.config.get ("context");
if (currentContext == "") if (currentContext == "")
out << STRING_CMD_CONTEXT_SHOW_EMPT << "\n"; out << STRING_CMD_CONTEXT_SHOW_EMPT << '\n';
else else
{ {
std::string currentFilter = context.config.get ("context." + currentContext); std::string currentFilter = context.config.get ("context." + currentContext);
out << format (STRING_CMD_CONTEXT_SHOW, currentContext, currentFilter) << "\n"; out << format (STRING_CMD_CONTEXT_SHOW, currentContext, currentFilter) << '\n';
} }
} }
@ -318,7 +318,7 @@ void CmdContext::unsetContext (std::stringstream& out)
if (CmdConfig::unsetConfigVariable ("context", false)) if (CmdConfig::unsetConfigVariable ("context", false))
throw std::string(STRING_CMD_CONTEXT_NON_FAIL); throw std::string(STRING_CMD_CONTEXT_NON_FAIL);
out << STRING_CMD_CONTEXT_NON_SUCC << "\n"; out << STRING_CMD_CONTEXT_NON_SUCC << '\n';
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -341,7 +341,7 @@ CmdCompletionContext::CmdCompletionContext ()
int CmdCompletionContext::execute (std::string& output) int CmdCompletionContext::execute (std::string& output)
{ {
for (auto& contet : CmdContext::getContexts ()) for (auto& contet : CmdContext::getContexts ())
output += contet + "\n"; output += contet + '\n';
return 0; return 0;
} }

View file

@ -62,7 +62,7 @@ int CmdCount::execute (std::string& output)
if (task.getStatus () != Task::recurring) if (task.getStatus () != Task::recurring)
++count; ++count;
output = format (count) + "\n"; output = format (count) + '\n';
return 0; return 0;
} }

View file

@ -225,7 +225,7 @@ int CmdCustom::execute (std::string& output)
out << ", " out << ", "
<< format (STRING_CMD_CUSTOM_TRUNCATED, maxlines - table_header); << format (STRING_CMD_CUSTOM_TRUNCATED, maxlines - table_header);
out << "\n"; out << '\n';
} }
} }
else else

View file

@ -159,7 +159,7 @@ int CmdDelete::execute (std::string&)
} }
else else
{ {
std::cout << STRING_CMD_DELETE_NO << "\n"; std::cout << STRING_CMD_DELETE_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;
@ -170,7 +170,7 @@ int CmdDelete::execute (std::string&)
std::cout << format (STRING_CMD_DELETE_NOT_DEL, std::cout << format (STRING_CMD_DELETE_NOT_DEL,
task.identifier (true), task.identifier (true),
task.get ("description")) task.get ("description"))
<< "\n"; << '\n';
rc = 1; rc = 1;
} }
} }

View file

@ -140,7 +140,7 @@ int CmdDenotate::execute (std::string&)
} }
else else
{ {
std::cout << STRING_CMD_DENO_NO << "\n"; std::cout << STRING_CMD_DENO_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;
@ -148,7 +148,7 @@ int CmdDenotate::execute (std::string&)
} }
else else
{ {
std::cout << format (STRING_CMD_DENO_NOMATCH, pattern) << "\n"; std::cout << format (STRING_CMD_DENO_NOMATCH, pattern) << '\n';
rc = 1; rc = 1;
} }
} }

View file

@ -75,19 +75,19 @@ int CmdDiagnostics::execute (std::string& output)
bold = Color ("bold"); bold = Color ("bold");
std::stringstream out; std::stringstream out;
out << "\n" out << '\n'
<< bold.colorize (PACKAGE_STRING) << bold.colorize (PACKAGE_STRING)
<< "\n"; << '\n';
out << " " << STRING_CMD_DIAG_PLATFORM << ": " << osName () out << " " << STRING_CMD_DIAG_PLATFORM << ": " << osName ()
<< "\n\n"; << "\n\n";
// Compiler. // Compiler.
out << bold.colorize (STRING_CMD_DIAG_COMPILER) out << bold.colorize (STRING_CMD_DIAG_COMPILER)
<< "\n" << '\n'
#ifdef __VERSION__ #ifdef __VERSION__
<< " " << STRING_CMD_DIAG_VERSION << ": " << " " << STRING_CMD_DIAG_VERSION << ": "
<< __VERSION__ << "\n" << __VERSION__ << '\n'
#endif #endif
<< " " << STRING_CMD_DIAG_CAPS << ":" << " " << STRING_CMD_DIAG_CAPS << ":"
#ifdef __STDC__ #ifdef __STDC__
@ -116,7 +116,7 @@ int CmdDiagnostics::execute (std::string& output)
<< " +l" << 8 * sizeof (long) << " +l" << 8 * sizeof (long)
<< " +vp" << 8 * sizeof (void*) << " +vp" << 8 * sizeof (void*)
<< " +time_t" << 8 * sizeof (time_t) << " +time_t" << 8 * sizeof (time_t)
<< "\n"; << '\n';
// Compiler compliance level. // Compiler compliance level.
std::string compliance = "non-compliant"; std::string compliance = "non-compliant";
@ -129,20 +129,20 @@ int CmdDiagnostics::execute (std::string& output)
else else
compliance = format (level); compliance = format (level);
#endif #endif
out << " " << STRING_CMD_DIAG_COMPLIANCE out << ' ' << STRING_CMD_DIAG_COMPLIANCE
<< ": " << ": "
<< compliance << compliance
<< "\n\n"; << "\n\n";
out << bold.colorize (STRING_CMD_DIAG_FEATURES) out << bold.colorize (STRING_CMD_DIAG_FEATURES)
<< "\n" << '\n'
// Build date. // Build date.
<< " " << STRING_CMD_DIAG_BUILT << ": " << __DATE__ << " " << __TIME__ << "\n" << " " << STRING_CMD_DIAG_BUILT << ": " << __DATE__ << ' ' << __TIME__ << '\n'
#ifdef HAVE_COMMIT #ifdef HAVE_COMMIT
<< " " << STRING_CMD_DIAG_COMMIT << ": " << COMMIT << "\n" << " " << STRING_CMD_DIAG_COMMIT << ": " << COMMIT << '\n'
#endif #endif
<< " CMake: " << CMAKE_VERSION << "\n"; << " CMake: " << CMAKE_VERSION << '\n';
out << " libuuid: " out << " libuuid: "
#ifdef HAVE_UUID_UNPARSE_LOWER #ifdef HAVE_UUID_UNPARSE_LOWER
@ -150,7 +150,7 @@ int CmdDiagnostics::execute (std::string& output)
#else #else
<< "libuuid, no uuid_unparse_lower" << "libuuid, no uuid_unparse_lower"
#endif #endif
<< "\n"; << '\n';
out << " libgnutls: " out << " libgnutls: "
#ifdef HAVE_LIBGNUTLS #ifdef HAVE_LIBGNUTLS
@ -162,7 +162,7 @@ int CmdDiagnostics::execute (std::string& output)
#else #else
<< "n/a" << "n/a"
#endif #endif
<< "\n"; << '\n';
out << " Build type: " out << " Build type: "
#ifdef CMAKE_BUILD_TYPE #ifdef CMAKE_BUILD_TYPE
@ -174,20 +174,20 @@ int CmdDiagnostics::execute (std::string& output)
// Config: .taskrc found, readable, writable // Config: .taskrc found, readable, writable
out << bold.colorize (STRING_CMD_DIAG_CONFIG) out << bold.colorize (STRING_CMD_DIAG_CONFIG)
<< "\n" << '\n'
<< " File: " << context.config._original_file._data << " " << " File: " << context.config._original_file._data << ' '
<< (context.config._original_file.exists () << (context.config._original_file.exists ()
? STRING_CMD_DIAG_FOUND ? STRING_CMD_DIAG_FOUND
: STRING_CMD_DIAG_MISSING) : STRING_CMD_DIAG_MISSING)
<< ", " << context.config._original_file.size () << " " << "bytes" << ", " << context.config._original_file.size () << ' ' << "bytes"
<< ", mode " << ", mode "
<< std::setbase (8) << std::setbase (8)
<< context.config._original_file.mode () << context.config._original_file.mode ()
<< "\n"; << '\n';
// Config: data.location found, readable, writable // Config: data.location found, readable, writable
File location (context.config.get ("data.location")); File location (context.config.get ("data.location"));
out << " Data: " << location._data << " " out << " Data: " << location._data << ' '
<< (location.exists () << (location.exists ()
? STRING_CMD_DIAG_FOUND ? STRING_CMD_DIAG_FOUND
: STRING_CMD_DIAG_MISSING) : STRING_CMD_DIAG_MISSING)
@ -195,44 +195,44 @@ int CmdDiagnostics::execute (std::string& output)
<< ", mode " << ", mode "
<< std::setbase (8) << std::setbase (8)
<< location.mode () << location.mode ()
<< "\n"; << '\n';
char* env = getenv ("TASKRC"); char* env = getenv ("TASKRC");
if (env) if (env)
out << " TASKRC: " out << " TASKRC: "
<< env << env
<< "\n"; << '\n';
env = getenv ("TASKDATA"); env = getenv ("TASKDATA");
if (env) if (env)
out << " TASKDATA: " out << " TASKDATA: "
<< env << env
<< "\n"; << '\n';
out << " Locking: " out << " Locking: "
<< (context.config.getBoolean ("locking") << (context.config.getBoolean ("locking")
? STRING_CMD_DIAG_ENABLED ? STRING_CMD_DIAG_ENABLED
: STRING_CMD_DIAG_DISABLED) : STRING_CMD_DIAG_DISABLED)
<< "\n"; << '\n';
out << " GC: " out << " GC: "
<< (context.config.getBoolean ("gc") << (context.config.getBoolean ("gc")
? STRING_CMD_DIAG_ENABLED ? STRING_CMD_DIAG_ENABLED
: STRING_CMD_DIAG_DISABLED) : STRING_CMD_DIAG_DISABLED)
<< "\n"; << '\n';
// Determine rc.editor/$EDITOR/$VISUAL. // Determine rc.editor/$EDITOR/$VISUAL.
char* peditor; char* peditor;
if (context.config.get ("editor") != "") if (context.config.get ("editor") != "")
out << " rc.editor: " << context.config.get ("editor") << "\n"; out << " rc.editor: " << context.config.get ("editor") << '\n';
else if ((peditor = getenv ("VISUAL")) != NULL) else if ((peditor = getenv ("VISUAL")) != NULL)
out << " $VISUAL: " << peditor << "\n"; out << " $VISUAL: " << peditor << '\n';
else if ((peditor = getenv ("EDITOR")) != NULL) else if ((peditor = getenv ("EDITOR")) != NULL)
out << " $EDITOR: " << peditor << "\n"; out << " $EDITOR: " << peditor << '\n';
out << " Server: " out << " Server: "
<< context.config.get ("taskd.server") << context.config.get ("taskd.server")
<< "\n"; << '\n';
if (context.config.get ("taskd.ca") != "") if (context.config.get ("taskd.ca") != "")
out << " CA: " out << " CA: "
@ -246,7 +246,7 @@ int CmdDiagnostics::execute (std::string& output)
if (trust_value == "strict" || if (trust_value == "strict" ||
trust_value == "ignore hostname" || trust_value == "ignore hostname" ||
trust_value == "allow all") trust_value == "allow all")
out << " Trust: " << trust_value << "\n"; out << " Trust: " << trust_value << '\n';
else else
out << " Trust: Bad value - see 'man taskrc'\n"; out << " Trust: Bad value - see 'man taskrc'\n";
@ -266,7 +266,7 @@ int CmdDiagnostics::execute (std::string& output)
out << " Ciphers: " out << " Ciphers: "
<< context.config.get ("taskd.ciphers") << context.config.get ("taskd.ciphers")
<< "\n"; << '\n';
// Get credentials, but mask out the key. // Get credentials, but mask out the key.
std::string credentials = context.config.get ("taskd.credentials"); std::string credentials = context.config.get ("taskd.credentials");
@ -285,13 +285,13 @@ int CmdDiagnostics::execute (std::string& output)
hookLocation += "hooks"; hookLocation += "hooks";
out << bold.colorize (STRING_CMD_DIAG_HOOKS) out << bold.colorize (STRING_CMD_DIAG_HOOKS)
<< "\n" << '\n'
<< " System: " << " System: "
<< (context.config.getBoolean ("hooks") ? STRING_CMD_DIAG_HOOK_ENABLE : STRING_CMD_DIAG_HOOK_DISABLE) << (context.config.getBoolean ("hooks") ? STRING_CMD_DIAG_HOOK_ENABLE : STRING_CMD_DIAG_HOOK_DISABLE)
<< "\n" << '\n'
<< " Location: " << " Location: "
<< static_cast <std::string> (hookLocation) << static_cast <std::string> (hookLocation)
<< "\n"; << '\n';
auto hooks = context.hooks.list (); auto hooks = context.hooks.list ();
if (hooks.size ()) if (hooks.size ())
@ -323,13 +323,13 @@ int CmdDiagnostics::execute (std::string& output)
out << std::left << name out << std::left << name
<< format (" ({1})", STRING_CMD_DIAG_HOOK_EXEC) << format (" ({1})", STRING_CMD_DIAG_HOOK_EXEC)
<< (p.is_link () ? format (" ({1})", STRING_CMD_DIAG_HOOK_SYMLINK) : "") << (p.is_link () ? format (" ({1})", STRING_CMD_DIAG_HOOK_SYMLINK) : "")
<< "\n"; << '\n';
} }
} }
} }
if (! count) if (! count)
out << "\n"; out << '\n';
out << " Inactive: "; out << " Inactive: ";
count = 0; count = 0;
@ -356,22 +356,22 @@ int CmdDiagnostics::execute (std::string& output)
name.substr (0, 9) == "on-modify" || name.substr (0, 9) == "on-modify" ||
name.substr (0, 9) == "on-launch" || name.substr (0, 9) == "on-launch" ||
name.substr (0, 7) == "on-exit") ? "" : format (" ({1})", STRING_CMD_DIAG_HOOK_NAME)) name.substr (0, 7) == "on-exit") ? "" : format (" ({1})", STRING_CMD_DIAG_HOOK_NAME))
<< "\n"; << '\n';
} }
} }
} }
if (! count) if (! count)
out << "\n"; out << '\n';
} }
else else
out << format (" ({1})\n", STRING_CMD_DIAG_NONE); out << format (" ({1})\n", STRING_CMD_DIAG_NONE);
out << "\n"; out << '\n';
// Verify UUIDs are all unique. // Verify UUIDs are all unique.
out << bold.colorize (STRING_CMD_DIAG_TESTS) out << bold.colorize (STRING_CMD_DIAG_TESTS)
<< "\n"; << '\n';
// Determine terminal details. // Determine terminal details.
const char* term = getenv ("TERM"); const char* term = getenv ("TERM");
@ -399,17 +399,17 @@ int CmdDiagnostics::execute (std::string& output)
out << " Dups: " out << " Dups: "
<< format (STRING_CMD_DIAG_UUID_SCAN, all.size ()) << format (STRING_CMD_DIAG_UUID_SCAN, all.size ())
<< "\n"; << '\n';
if (dups.size ()) if (dups.size ())
{ {
for (auto& d : dups) for (auto& d : dups)
out << " " << format (STRING_CMD_DIAG_UUID_DUP, d) << "\n"; out << " " << format (STRING_CMD_DIAG_UUID_DUP, d) << '\n';
} }
else else
{ {
out << " " << STRING_CMD_DIAG_UUID_NO_DUP out << " " << STRING_CMD_DIAG_UUID_NO_DUP
<< "\n"; << '\n';
} }
@ -418,7 +418,7 @@ int CmdDiagnostics::execute (std::string& output)
bool noBrokenRefs = true; bool noBrokenRefs = true;
out << " Broken ref: " out << " Broken ref: "
<< format (STRING_CMD_DIAG_REF_SCAN, all.size ()) << format (STRING_CMD_DIAG_REF_SCAN, all.size ())
<< "\n"; << '\n';
for (auto& task : all) for (auto& task : all)
{ {
@ -432,7 +432,7 @@ int CmdDiagnostics::execute (std::string& output)
{ {
out << " " out << " "
<< format (STRING_CMD_DIAG_MISS_DEP, task.get ("uuid"), uuid) << format (STRING_CMD_DIAG_MISS_DEP, task.get ("uuid"), uuid)
<< "\n"; << '\n';
noBrokenRefs = false; noBrokenRefs = false;
} }
} }
@ -444,16 +444,16 @@ int CmdDiagnostics::execute (std::string& output)
{ {
out << " " out << " "
<< format (STRING_CMD_DIAG_MISS_PAR, task.get ("uuid"), parentUUID) << format (STRING_CMD_DIAG_MISS_PAR, task.get ("uuid"), parentUUID)
<< "\n"; << '\n';
noBrokenRefs = false; noBrokenRefs = false;
} }
} }
if (noBrokenRefs) if (noBrokenRefs)
out << " " << STRING_CMD_DIAG_REF_OK out << " " << STRING_CMD_DIAG_REF_OK
<< "\n"; << '\n';
out << "\n"; out << '\n';
output = out.str (); output = out.str ();
return 0; return 0;
} }

View file

@ -112,7 +112,7 @@ int CmdDone::execute (std::string&)
} }
else else
{ {
std::cout << STRING_CMD_DONE_NO << "\n"; std::cout << STRING_CMD_DONE_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;
@ -123,7 +123,7 @@ int CmdDone::execute (std::string&)
std::cout << format (STRING_CMD_DONE_NOTPEND, std::cout << format (STRING_CMD_DONE_NOTPEND,
task.identifier (true), task.identifier (true),
task.get ("description")) task.get ("description"))
<< "\n"; << '\n';
rc = 1; rc = 1;
} }
} }

View file

@ -89,7 +89,7 @@ int CmdDuplicate::execute (std::string&)
dup.remove ("until"); dup.remove ("until");
dup.remove ("imask"); dup.remove ("imask");
std::cout << format (STRING_CMD_DUPLICATE_NON_REC, task.identifier ()) std::cout << format (STRING_CMD_DUPLICATE_NON_REC, task.identifier ())
<< "\n"; << '\n';
} }
// When duplicating a parent task, create a new parent task. // When duplicating a parent task, create a new parent task.
@ -97,7 +97,7 @@ int CmdDuplicate::execute (std::string&)
{ {
dup.remove ("mask"); dup.remove ("mask");
std::cout << format (STRING_CMD_DUPLICATE_REC, task.identifier ()) std::cout << format (STRING_CMD_DUPLICATE_REC, task.identifier ())
<< "\n"; << '\n';
} }
dup.setStatus (Task::pending); // Does not inherit status. dup.setStatus (Task::pending); // Does not inherit status.
@ -118,18 +118,18 @@ int CmdDuplicate::execute (std::string&)
if (context.verbose ("new-id") && if (context.verbose ("new-id") &&
(status == Task::pending || (status == Task::pending ||
status == Task::waiting)) status == Task::waiting))
std::cout << format (STRING_CMD_ADD_FEEDBACK, dup.id) + "\n"; std::cout << format (STRING_CMD_ADD_FEEDBACK, dup.id) + '\n';
else if (context.verbose ("new-uuid") && else if (context.verbose ("new-uuid") &&
status != Task::recurring) status != Task::recurring)
std::cout << format (STRING_CMD_ADD_FEEDBACK, dup.get ("uuid")) + "\n"; std::cout << format (STRING_CMD_ADD_FEEDBACK, dup.get ("uuid")) + '\n';
if (context.verbose ("project")) if (context.verbose ("project"))
projectChanges[task.get ("project")] = onProjectChange (task); projectChanges[task.get ("project")] = onProjectChange (task);
} }
else else
{ {
std::cout << STRING_CMD_DUPLICATE_NO << "\n"; std::cout << STRING_CMD_DUPLICATE_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;

View file

@ -102,7 +102,7 @@ std::string CmdEdit::findValue (
auto found = text.find (name); auto found = text.find (name);
if (found != std::string::npos) if (found != std::string::npos)
{ {
auto eol = text.find ("\n", found + 1); auto eol = text.find ('\n', found + 1);
if (eol != std::string::npos) if (eol != std::string::npos)
{ {
std::string value = text.substr ( std::string value = text.substr (
@ -149,7 +149,7 @@ std::vector <std::string> CmdEdit::findValues (
found = text.find (name, found + 1); found = text.find (name, found + 1);
if (found != std::string::npos) if (found != std::string::npos)
{ {
auto eol = text.find ("\n", found + 1); auto eol = text.find ('\n', found + 1);
if (eol != std::string::npos) if (eol != std::string::npos)
{ {
std::string value = text.substr ( std::string value = text.substr (
@ -203,30 +203,30 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
bool verbose = context.verbose ("edit"); bool verbose = context.verbose ("edit");
if (verbose) if (verbose)
before << "# " << STRING_EDIT_HEADER_1 << "\n" before << "# " << STRING_EDIT_HEADER_1 << '\n'
<< "# " << STRING_EDIT_HEADER_2 << "\n" << "# " << STRING_EDIT_HEADER_2 << '\n'
<< "# " << STRING_EDIT_HEADER_3 << "\n" << "# " << STRING_EDIT_HEADER_3 << '\n'
<< "# " << STRING_EDIT_HEADER_4 << "\n" << "# " << STRING_EDIT_HEADER_4 << '\n'
<< "# " << STRING_EDIT_HEADER_5 << "\n" << "# " << STRING_EDIT_HEADER_5 << '\n'
<< "# " << STRING_EDIT_HEADER_6 << "\n" << "# " << STRING_EDIT_HEADER_6 << '\n'
<< "#\n" << "#\n"
<< "# " << STRING_EDIT_HEADER_7 << "\n" << "# " << STRING_EDIT_HEADER_7 << '\n'
<< "# " << STRING_EDIT_HEADER_8 << "\n" << "# " << STRING_EDIT_HEADER_8 << '\n'
<< "# " << STRING_EDIT_HEADER_9 << "\n" << "# " << STRING_EDIT_HEADER_9 << '\n'
<< "#\n" << "#\n"
<< "# " << STRING_EDIT_HEADER_10 << "\n" << "# " << STRING_EDIT_HEADER_10 << '\n'
<< "# " << STRING_EDIT_HEADER_11 << "\n" << "# " << STRING_EDIT_HEADER_11 << '\n'
<< "# " << STRING_EDIT_HEADER_12 << "\n" << "# " << STRING_EDIT_HEADER_12 << '\n'
<< "#\n"; << "#\n";
before << "# " << STRING_EDIT_TABLE_HEADER_1 << "\n" before << "# " << STRING_EDIT_TABLE_HEADER_1 << '\n'
<< "# " << STRING_EDIT_TABLE_HEADER_2 << "\n" << "# " << STRING_EDIT_TABLE_HEADER_2 << '\n'
<< "# ID: " << task.id << "\n" << "# ID: " << task.id << '\n'
<< "# UUID: " << task.get ("uuid") << "\n" << "# UUID: " << task.get ("uuid") << '\n'
<< "# Status: " << Lexer::ucFirst (Task::statusToText (task.getStatus ())) << "\n" << "# Status: " << Lexer::ucFirst (Task::statusToText (task.getStatus ())) << '\n'
<< "# Mask: " << task.get ("mask") << "\n" << "# Mask: " << task.get ("mask") << '\n'
<< "# iMask: " << task.get ("imask") << "\n" << "# iMask: " << task.get ("imask") << '\n'
<< " Project: " << task.get ("project") << "\n"; << " Project: " << task.get ("project") << '\n';
std::vector <std::string> tags; std::vector <std::string> tags;
task.getTags (tags); task.getTags (tags);
@ -234,25 +234,25 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
join (allTags, " ", tags); join (allTags, " ", tags);
if (verbose) if (verbose)
before << "# " << STRING_EDIT_TAG_SEP << "\n"; before << "# " << STRING_EDIT_TAG_SEP << '\n';
before << " Tags: " << allTags << "\n" before << " Tags: " << allTags << '\n'
<< " Description: " << task.get ("description") << "\n" << " Description: " << task.get ("description") << '\n'
<< " Created: " << formatDate (task, "entry", dateformat) << "\n" << " Created: " << formatDate (task, "entry", dateformat) << '\n'
<< " Started: " << formatDate (task, "start", dateformat) << "\n" << " Started: " << formatDate (task, "start", dateformat) << '\n'
<< " Ended: " << formatDate (task, "end", dateformat) << "\n" << " Ended: " << formatDate (task, "end", dateformat) << '\n'
<< " Scheduled: " << formatDate (task, "scheduled", dateformat) << "\n" << " Scheduled: " << formatDate (task, "scheduled", dateformat) << '\n'
<< " Due: " << formatDate (task, "due", dateformat) << "\n" << " Due: " << formatDate (task, "due", dateformat) << '\n'
<< " Until: " << formatDate (task, "until", dateformat) << "\n" << " Until: " << formatDate (task, "until", dateformat) << '\n'
<< " Recur: " << task.get ("recur") << "\n" << " Recur: " << task.get ("recur") << '\n'
<< " Wait until: " << formatDate (task, "wait", dateformat) << "\n" << " Wait until: " << formatDate (task, "wait", dateformat) << '\n'
<< "# Modified: " << formatDate (task, "modified", dateformat) << "\n" << "# Modified: " << formatDate (task, "modified", dateformat) << '\n'
<< " Parent: " << task.get ("parent") << "\n"; << " Parent: " << task.get ("parent") << '\n';
if (verbose) if (verbose)
before << "# " << STRING_EDIT_HEADER_13 << "\n" before << "# " << STRING_EDIT_HEADER_13 << '\n'
<< "# " << STRING_EDIT_HEADER_14 << "\n" << "# " << STRING_EDIT_HEADER_14 << '\n'
<< "# " << STRING_EDIT_HEADER_15 << "\n"; << "# " << STRING_EDIT_HEADER_15 << '\n';
std::map <std::string, std::string> annotations; std::map <std::string, std::string> annotations;
task.getAnnotations (annotations); task.getAnnotations (annotations);
@ -260,7 +260,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
{ {
ISO8601d dt (strtol (anno.first.substr (11).c_str (), NULL, 10)); ISO8601d dt (strtol (anno.first.substr (11).c_str (), NULL, 10));
before << " Annotation: " << dt.toString (dateformat) before << " Annotation: " << dt.toString (dateformat)
<< " -- " << json::encode (anno.second) << "\n"; << " -- " << json::encode (anno.second) << '\n';
} }
ISO8601d now; ISO8601d now;
@ -285,9 +285,9 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
} }
if (verbose) if (verbose)
before << "# " << STRING_EDIT_DEP_SEP << "\n"; before << "# " << STRING_EDIT_DEP_SEP << '\n';
before << " Dependencies: " << allDeps.str () << "\n"; before << " Dependencies: " << allDeps.str () << '\n';
// UDAs // UDAs
std::vector <std::string> udas; std::vector <std::string> udas;
@ -297,7 +297,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
if (udas.size ()) if (udas.size ())
{ {
before << "# " << STRING_EDIT_UDA_SEP << "\n"; before << "# " << STRING_EDIT_UDA_SEP << '\n';
std::sort (udas.begin (), udas.end ()); std::sort (udas.begin (), udas.end ());
for (auto& uda : udas) for (auto& uda : udas)
{ {
@ -307,12 +307,12 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
padding = std::string (pad, ' '); padding = std::string (pad, ' ');
std::string type = context.config.get ("uda." + uda + ".type"); std::string type = context.config.get ("uda." + uda + ".type");
if (type == "string" || type == "numeric") if (type == "string" || type == "numeric")
before << " UDA " << uda << ": " << padding << task.get (uda) << "\n"; before << " UDA " << uda << ": " << padding << task.get (uda) << '\n';
else if (type == "date") else if (type == "date")
before << " UDA " << uda << ": " << padding << formatDate (task, uda, dateformat) << "\n"; before << " UDA " << uda << ": " << padding << formatDate (task, uda, dateformat) << '\n';
else if (type == "duration") else if (type == "duration")
before << " UDA " << uda << ": " << padding << formatDuration (task, uda) << "\n"; before << " UDA " << uda << ": " << padding << formatDuration (task, uda) << '\n';
} }
} }
@ -322,7 +322,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
if (orphans.size ()) if (orphans.size ())
{ {
before << "# " << STRING_EDIT_UDA_ORPHAN_SEP << "\n"; before << "# " << STRING_EDIT_UDA_ORPHAN_SEP << '\n';
std::sort (orphans.begin (), orphans.end ()); std::sort (orphans.begin (), orphans.end ());
for (auto& orphan : orphans) for (auto& orphan : orphans)
{ {
@ -331,11 +331,11 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat)
if (pad > 0) if (pad > 0)
padding = std::string (pad, ' '); padding = std::string (pad, ' ');
before << " UDA Orphan " << orphan << ": " << padding << task.get (orphan) << "\n"; before << " UDA Orphan " << orphan << ": " << padding << task.get (orphan) << '\n';
} }
} }
before << "# " << STRING_EDIT_END << "\n"; before << "# " << STRING_EDIT_END << '\n';
return before.str (); return before.str ();
} }
@ -633,7 +633,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string
{ {
found += 14; // Length of "\n Annotation:". found += 14; // Length of "\n Annotation:".
auto eol = after.find ("\n", found + 1); auto eol = after.find ('\n', found + 1);
if (eol != std::string::npos) if (eol != std::string::npos)
{ {
std::string value = Lexer::trim (after.substr ( std::string value = Lexer::trim (after.substr (
@ -797,22 +797,22 @@ CmdEdit::editResult CmdEdit::editFile (Task& task)
if (editor == "") editor = "vi"; if (editor == "") editor = "vi";
// Complete the command line. // Complete the command line.
editor += " "; editor += ' ';
editor += "\"" + file.str () + "\""; editor += "\"" + file.str () + "\"";
ARE_THESE_REALLY_HARMFUL: ARE_THESE_REALLY_HARMFUL:
bool changes = false; // No changes made. bool changes = false; // No changes made.
// Launch the editor. // Launch the editor.
std::cout << format (STRING_EDIT_LAUNCHING, editor) << "\n"; std::cout << format (STRING_EDIT_LAUNCHING, editor) << '\n';
int exitcode = system (editor.c_str ()); int exitcode = system (editor.c_str ());
if (0 == exitcode) if (0 == exitcode)
std::cout << STRING_EDIT_COMPLETE << "\n"; std::cout << STRING_EDIT_COMPLETE << '\n';
else else
{ {
std::cout << format (STRING_EDIT_FAILED, exitcode) << "\n"; std::cout << format (STRING_EDIT_FAILED, exitcode) << '\n';
if (-1 == exitcode) if (-1 == exitcode)
std::cout << std::strerror (errno) << "\n"; std::cout << std::strerror (errno) << '\n';
return CmdEdit::editResult::error; return CmdEdit::editResult::error;
} }
@ -824,7 +824,7 @@ ARE_THESE_REALLY_HARMFUL:
// if changes were made. // if changes were made.
if (before_orig != after) if (before_orig != after)
{ {
std::cout << STRING_EDIT_CHANGES << "\n"; std::cout << STRING_EDIT_CHANGES << '\n';
std::string problem = ""; std::string problem = "";
bool oops = false; bool oops = false;
@ -841,7 +841,7 @@ ARE_THESE_REALLY_HARMFUL:
if (oops) if (oops)
{ {
std::cerr << STRING_ERROR_PREFIX << problem << "\n"; std::cerr << STRING_ERROR_PREFIX << problem << '\n';
// Preserve the edits. // Preserve the edits.
before = after; before = after;
@ -855,7 +855,7 @@ ARE_THESE_REALLY_HARMFUL:
} }
else else
{ {
std::cout << STRING_EDIT_NO_CHANGES << "\n"; std::cout << STRING_EDIT_NO_CHANGES << '\n';
changes = false; changes = false;
} }

View file

@ -85,7 +85,7 @@ int CmdExport::execute (std::string& output)
{ {
if (json_array) if (json_array)
output += ","; output += ",";
output += "\n"; output += '\n';
} }
output += task.composeJSON (true); output += task.composeJSON (true);
@ -96,7 +96,7 @@ int CmdExport::execute (std::string& output)
} }
if (filtered.size ()) if (filtered.size ())
output += "\n"; output += '\n';
if (json_array) if (json_array)
output += "]\n"; output += "]\n";

View file

@ -91,7 +91,7 @@ int CmdGet::execute (std::string& output)
throw std::string (STRING_CMD_GET_NO_DOM); throw std::string (STRING_CMD_GET_NO_DOM);
join (output, " ", results); join (output, " ", results);
output += "\n"; output += '\n';
return 0; return 0;
} }

View file

@ -32,7 +32,6 @@
#include <i18n.h> #include <i18n.h>
#include <text.h> #include <text.h>
#include <util.h> #include <util.h>
#include <iostream> // TODO Remove
extern Context context; extern Context context;
@ -57,13 +56,13 @@ int CmdHelp::execute (std::string& output)
{ {
auto words = context.cli2.getWords (); auto words = context.cli2.getWords ();
if (words.size () == 1 && closeEnough ("usage", words[0])) if (words.size () == 1 && closeEnough ("usage", words[0]))
output = "\n" output = '\n'
+ composeUsage () + composeUsage ()
+ "\n"; + '\n';
else else
output = "\n" output = '\n'
+ composeUsage () + composeUsage ()
+ "\n" + '\n'
+ STRING_CMD_HELP_TEXT; + STRING_CMD_HELP_TEXT;
return 0; return 0;

View file

@ -174,7 +174,7 @@ int CmdHistoryMonthly::execute (std::string& output)
if (view.rows ()) if (view.rows ())
{ {
row = view.addRow (); row = view.addRow ();
view.set (row, 0, " "); view.set (row, 0, ' ');
row = view.addRow (); row = view.addRow ();
Color row_color; Color row_color;
@ -192,7 +192,7 @@ int CmdHistoryMonthly::execute (std::string& output)
if (view.rows ()) if (view.rows ())
out << optionalBlankLine () out << optionalBlankLine ()
<< view.render () << view.render ()
<< "\n"; << '\n';
else else
{ {
context.footnote (STRING_FEEDBACK_NO_TASKS); context.footnote (STRING_FEEDBACK_NO_TASKS);
@ -354,7 +354,7 @@ int CmdHistoryAnnual::execute (std::string& output)
if (view.rows ()) if (view.rows ())
out << optionalBlankLine () out << optionalBlankLine ()
<< view.render () << view.render ()
<< "\n"; << '\n';
else else
{ {
context.footnote (STRING_FEEDBACK_NO_TASKS); context.footnote (STRING_FEEDBACK_NO_TASKS);
@ -498,7 +498,7 @@ int CmdGHistoryMonthly::execute (std::string& output)
{ {
aBar = format (addedGroup[i.first]); aBar = format (addedGroup[i.first]);
while (aBar.length () < addedBar) while (aBar.length () < addedBar)
aBar = " " + aBar; aBar = ' ' + aBar;
} }
std::string cBar = ""; std::string cBar = "";
@ -506,7 +506,7 @@ int CmdGHistoryMonthly::execute (std::string& output)
{ {
cBar = format (completedGroup[i.first]); cBar = format (completedGroup[i.first]);
while (cBar.length () < completedBar) while (cBar.length () < completedBar)
cBar = " " + cBar; cBar = ' ' + cBar;
} }
std::string dBar = ""; std::string dBar = "";
@ -514,7 +514,7 @@ int CmdGHistoryMonthly::execute (std::string& output)
{ {
dBar = format (deletedGroup[i.first]); dBar = format (deletedGroup[i.first]);
while (dBar.length () < deletedBar) while (dBar.length () < deletedBar)
dBar = " " + dBar; dBar = ' ' + dBar;
} }
bar += std::string (leftOffset - aBar.length (), ' '); bar += std::string (leftOffset - aBar.length (), ' ');
@ -542,7 +542,7 @@ int CmdGHistoryMonthly::execute (std::string& output)
{ {
out << optionalBlankLine () out << optionalBlankLine ()
<< view.render () << view.render ()
<< "\n"; << '\n';
if (context.color ()) if (context.color ())
out << format (STRING_CMD_HISTORY_LEGEND, out << format (STRING_CMD_HISTORY_LEGEND,
@ -550,10 +550,10 @@ int CmdGHistoryMonthly::execute (std::string& output)
color_done.colorize (STRING_CMD_HISTORY_COMP), color_done.colorize (STRING_CMD_HISTORY_COMP),
color_delete.colorize (STRING_CMD_HISTORY_DEL)) color_delete.colorize (STRING_CMD_HISTORY_DEL))
<< optionalBlankLine () << optionalBlankLine ()
<< "\n"; << '\n';
else else
out << STRING_CMD_HISTORY_LEGEND_A out << STRING_CMD_HISTORY_LEGEND_A
<< "\n"; << '\n';
} }
else else
{ {
@ -696,7 +696,7 @@ int CmdGHistoryAnnual::execute (std::string& output)
{ {
aBar = format (addedGroup[i.first]); aBar = format (addedGroup[i.first]);
while (aBar.length () < addedBar) while (aBar.length () < addedBar)
aBar = " " + aBar; aBar = ' ' + aBar;
} }
std::string cBar = ""; std::string cBar = "";
@ -704,7 +704,7 @@ int CmdGHistoryAnnual::execute (std::string& output)
{ {
cBar = format (completedGroup[i.first]); cBar = format (completedGroup[i.first]);
while (cBar.length () < completedBar) while (cBar.length () < completedBar)
cBar = " " + cBar; cBar = ' ' + cBar;
} }
std::string dBar = ""; std::string dBar = "";
@ -712,7 +712,7 @@ int CmdGHistoryAnnual::execute (std::string& output)
{ {
dBar = format (deletedGroup[i.first]); dBar = format (deletedGroup[i.first]);
while (dBar.length () < deletedBar) while (dBar.length () < deletedBar)
dBar = " " + dBar; dBar = ' ' + dBar;
} }
bar += std::string (leftOffset - aBar.length (), ' '); bar += std::string (leftOffset - aBar.length (), ' ');
@ -739,7 +739,7 @@ int CmdGHistoryAnnual::execute (std::string& output)
{ {
out << optionalBlankLine () out << optionalBlankLine ()
<< view.render () << view.render ()
<< "\n"; << '\n';
if (context.color ()) if (context.color ())
out << format (STRING_CMD_HISTORY_LEGEND, out << format (STRING_CMD_HISTORY_LEGEND,
@ -747,10 +747,10 @@ int CmdGHistoryAnnual::execute (std::string& output)
color_done.colorize (STRING_CMD_HISTORY_COMP), color_done.colorize (STRING_CMD_HISTORY_COMP),
color_delete.colorize (STRING_CMD_HISTORY_DEL)) color_delete.colorize (STRING_CMD_HISTORY_DEL))
<< optionalBlankLine () << optionalBlankLine ()
<< "\n"; << '\n';
else else
out << STRING_CMD_HISTORY_LEGEND_A out << STRING_CMD_HISTORY_LEGEND_A
<< "\n"; << '\n';
} }
else else
{ {

View file

@ -70,7 +70,7 @@ int CmdIDs::execute (std::string& output)
ids.push_back (task.id); ids.push_back (task.id);
std::sort (ids.begin (), ids.end ()); std::sort (ids.begin (), ids.end ());
output = compressIds (ids) + "\n"; output = compressIds (ids) + '\n';
context.headers.clear (); context.headers.clear ();
return 0; return 0;
@ -100,7 +100,7 @@ std::string CmdIDs::compressIds (const std::vector <int>& ids)
if (i + 1 == ids.size ()) if (i + 1 == ids.size ())
{ {
if (result.str ().length ()) if (result.str ().length ())
result << " "; result << ' ';
if (range_start < range_end) if (range_start < range_end)
result << ids[range_start] << "-" << ids[range_end]; result << ids[range_start] << "-" << ids[range_end];
@ -116,7 +116,7 @@ std::string CmdIDs::compressIds (const std::vector <int>& ids)
else else
{ {
if (result.str ().length ()) if (result.str ().length ())
result << " "; result << ' ';
if (range_start < range_end) if (range_start < range_end)
result << ids[range_start] << "-" << ids[range_end]; result << ids[range_start] << "-" << ids[range_end];
@ -164,7 +164,7 @@ int CmdCompletionIds::execute (std::string& output)
std::sort (ids.begin (), ids.end ()); std::sort (ids.begin (), ids.end ());
join (output, "\n", ids); join (output, "\n", ids);
output += "\n"; output += '\n';
context.headers.clear (); context.headers.clear ();
return 0; return 0;
@ -200,9 +200,9 @@ int CmdZshCompletionIds::execute (std::string& output)
if (task.getStatus () != Task::deleted && if (task.getStatus () != Task::deleted &&
task.getStatus () != Task::completed) task.getStatus () != Task::completed)
out << task.id out << task.id
<< ":" << ':'
<< str_replace(task.get ("description"), ":", zshColonReplacement) << str_replace(task.get ("description"), ":", zshColonReplacement)
<< "\n"; << '\n';
output = out.str (); output = out.str ();
@ -241,7 +241,7 @@ int CmdUUIDs::execute (std::string& output)
std::sort (uuids.begin (), uuids.end ()); std::sort (uuids.begin (), uuids.end ());
join (output, " ", uuids); join (output, " ", uuids);
output += "\n"; output += '\n';
context.headers.clear (); context.headers.clear ();
return 0; return 0;
@ -278,7 +278,7 @@ int CmdCompletionUuids::execute (std::string& output)
std::sort (uuids.begin (), uuids.end ()); std::sort (uuids.begin (), uuids.end ());
join (output, "\n", uuids); join (output, "\n", uuids);
output += "\n"; output += '\n';
context.headers.clear (); context.headers.clear ();
return 0; return 0;
@ -314,7 +314,7 @@ int CmdZshCompletionUuids::execute (std::string& output)
out << task.get ("uuid") out << task.get ("uuid")
<< ":" << ":"
<< str_replace (task.get ("description"), ":", zshColonReplacement) << str_replace (task.get ("description"), ":", zshColonReplacement)
<< "\n"; << '\n';
output = out.str (); output = out.str ();

View file

@ -64,12 +64,12 @@ int CmdImport::execute (std::string&)
std::vector <std::string> words = context.cli2.getWords (); std::vector <std::string> words = context.cli2.getWords ();
if (! words.size () || (words.size () == 1 && words[0] == "-")) if (! words.size () || (words.size () == 1 && words[0] == "-"))
{ {
std::cout << format (STRING_CMD_IMPORT_FILE, "STDIN") << "\n"; std::cout << format (STRING_CMD_IMPORT_FILE, "STDIN") << '\n';
std::string json; std::string json;
std::string line; std::string line;
while (std::getline (std::cin, line)) while (std::getline (std::cin, line))
json += line + "\n"; json += line + '\n';
if (nontrivial (json)) if (nontrivial (json))
count = import (json); count = import (json);
@ -83,7 +83,7 @@ int CmdImport::execute (std::string&)
if (! incoming.exists ()) if (! incoming.exists ())
throw format (STRING_CMD_IMPORT_MISSING, word); throw format (STRING_CMD_IMPORT_MISSING, word);
std::cout << format (STRING_CMD_IMPORT_FILE, word) << "\n"; std::cout << format (STRING_CMD_IMPORT_FILE, word) << '\n';
// Load the file. // Load the file.
std::string json; std::string json;
@ -224,9 +224,9 @@ void CmdImport::importSingleTask (json::object* obj)
} }
std::cout << task.get ("uuid") std::cout << task.get ("uuid")
<< " " << ' '
<< task.get ("description") << task.get ("description")
<< "\n"; << '\n';
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -130,10 +130,10 @@ int CmdInfo::execute (std::string& output)
std::map <std::string, std::string> annotations; std::map <std::string, std::string> annotations;
task.getAnnotations (annotations); task.getAnnotations (annotations);
for (auto& anno : annotations) for (auto& anno : annotations)
description += "\n" description += '\n'
+ std::string (indent, ' ') + std::string (indent, ' ')
+ ISO8601d (anno.first.substr (11)).toString (dateformatanno) + ISO8601d (anno.first.substr (11)).toString (dateformatanno)
+ " " + ' '
+ anno.second; + anno.second;
row = view.addRow (); row = view.addRow ();
@ -161,7 +161,7 @@ int CmdInfo::execute (std::string& output)
{ {
std::stringstream message; std::stringstream message;
for (auto& block : blocked) for (auto& block : blocked)
message << block.id << " " << block.get ("description") << "\n"; message << block.id << ' ' << block.get ("description") << '\n';
row = view.addRow (); row = view.addRow ();
view.set (row, 0, STRING_CMD_INFO_BLOCKED); view.set (row, 0, STRING_CMD_INFO_BLOCKED);
@ -177,7 +177,7 @@ int CmdInfo::execute (std::string& output)
{ {
std::stringstream message; std::stringstream message;
for (auto& block : blocking) for (auto& block : blocking)
message << block.id << " " << block.get ("description") << "\n"; message << block.id << ' ' << block.get ("description") << '\n';
row = view.addRow (); row = view.addRow ();
view.set (row, 0, STRING_CMD_INFO_BLOCKING); view.set (row, 0, STRING_CMD_INFO_BLOCKING);
@ -558,15 +558,15 @@ int CmdInfo::execute (std::string& output)
out << optionalBlankLine () out << optionalBlankLine ()
<< view.render () << view.render ()
<< "\n"; << '\n';
if (urgencyDetails.rows () > 0) if (urgencyDetails.rows () > 0)
out << urgencyDetails.render () out << urgencyDetails.render ()
<< "\n"; << '\n';
if (journal.rows () > 0) if (journal.rows () > 0)
out << journal.render () out << journal.render ()
<< "\n"; << '\n';
} }
output = out.str (); output = out.str ();

View file

@ -72,7 +72,7 @@ int CmdLog::execute (std::string& output)
context.footnote (onProjectChange (task)); context.footnote (onProjectChange (task));
if (context.verbose ("new-uuid")) if (context.verbose ("new-uuid"))
output = format (STRING_CMD_LOG_LOGGED, task.get ("uuid")) + "\n"; output = format (STRING_CMD_LOG_LOGGED, task.get ("uuid")) + '\n';
return 0; return 0;
} }

View file

@ -127,7 +127,7 @@ int CmdLogo::execute (std::string& output)
} }
} }
output += "\n"; output += '\n';
} }
output += optionalBlankLine (); output += optionalBlankLine ();

View file

@ -92,7 +92,7 @@ int CmdModify::execute (std::string&)
} }
else else
{ {
std::cout << STRING_CMD_MODIFY_NO << "\n"; std::cout << STRING_CMD_MODIFY_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;

View file

@ -118,7 +118,7 @@ int CmdPrepend::execute (std::string&)
} }
else else
{ {
std::cout << STRING_CMD_PREPEND_NO << "\n"; std::cout << STRING_CMD_PREPEND_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;

View file

@ -147,15 +147,15 @@ int CmdProjects::execute (std::string& output)
<< (number_projects == 1 << (number_projects == 1
? format (STRING_CMD_PROJECTS_SUMMARY, number_projects) ? format (STRING_CMD_PROJECTS_SUMMARY, number_projects)
: format (STRING_CMD_PROJECTS_SUMMARY2, number_projects)) : format (STRING_CMD_PROJECTS_SUMMARY2, number_projects))
<< " " << ' '
<< (quantity == 1 << (quantity == 1
? format (STRING_CMD_PROJECTS_TASK, quantity) ? format (STRING_CMD_PROJECTS_TASK, quantity)
: format (STRING_CMD_PROJECTS_TASKS, quantity)) : format (STRING_CMD_PROJECTS_TASKS, quantity))
<< "\n"; << '\n';
} }
else else
{ {
out << STRING_CMD_PROJECTS_NO << "\n"; out << STRING_CMD_PROJECTS_NO << '\n';
rc = 1; rc = 1;
} }
@ -203,7 +203,7 @@ int CmdCompletionProjects::execute (std::string& output)
for (auto& project : unique) for (auto& project : unique)
if (project.first.length ()) if (project.first.length ())
output += project.first + "\n"; output += project.first + '\n';
return 0; return 0;
} }

View file

@ -111,7 +111,7 @@ int CmdReports::execute (std::string& output)
<< view.render () << view.render ()
<< optionalBlankLine () << optionalBlankLine ()
<< format (STRING_CMD_REPORTS_SUMMARY, reports.size ()) << format (STRING_CMD_REPORTS_SUMMARY, reports.size ())
<< "\n"; << '\n';
output = out.str (); output = out.str ();
return 0; return 0;

View file

@ -222,7 +222,7 @@ int CmdShow::execute (std::string& output)
{ {
// Disallow partial matches by tacking a leading and trailing space on each // Disallow partial matches by tacking a leading and trailing space on each
// variable name. // variable name.
std::string pattern = " " + i.first + " "; std::string pattern = ' ' + i.first + ' ';
if (recognized.find (pattern) == std::string::npos) if (recognized.find (pattern) == std::string::npos)
{ {
// These are special configuration variables, because their name is // These are special configuration variables, because their name is
@ -320,14 +320,14 @@ int CmdShow::execute (std::string& output)
} }
} }
out << "\n" out << '\n'
<< view.render () << view.render ()
<< (view.rows () == 0 ? STRING_CMD_SHOW_NONE : "") << (view.rows () == 0 ? STRING_CMD_SHOW_NONE : "")
<< (view.rows () == 0 ? "\n\n" : "\n"); << (view.rows () == 0 ? "\n\n" : "\n");
if (issue_warning) if (issue_warning)
{ {
out << STRING_CMD_SHOW_DIFFER << "\n"; out << STRING_CMD_SHOW_DIFFER << '\n';
if (context.color () && warning.nontrivial ()) if (context.color () && warning.nontrivial ())
out << " " out << " "
@ -338,13 +338,13 @@ int CmdShow::execute (std::string& output)
// Display the unrecognized variables. // Display the unrecognized variables.
if (issue_error) if (issue_error)
{ {
out << STRING_CMD_SHOW_UNREC << "\n"; out << STRING_CMD_SHOW_UNREC << '\n';
for (auto& i : unrecognized) for (auto& i : unrecognized)
out << " " << i << "\n"; out << " " << i << '\n';
if (context.color () && error.nontrivial ()) if (context.color () && error.nontrivial ())
out << "\n" << format (STRING_CMD_SHOW_DIFFER_COLOR, error.colorize ("color")); out << '\n' << format (STRING_CMD_SHOW_DIFFER_COLOR, error.colorize ("color"));
out << "\n\n"; out << "\n\n";
} }
@ -361,7 +361,7 @@ int CmdShow::execute (std::string& output)
calendardetails != "sparse" && calendardetails != "sparse" &&
calendardetails != "none") calendardetails != "none")
out << format (STRING_CMD_SHOW_CONFIG_ERROR, "calendar.details", calendardetails) out << format (STRING_CMD_SHOW_CONFIG_ERROR, "calendar.details", calendardetails)
<< "\n"; << '\n';
// Check for bad values in rc.calendar.holidays. // Check for bad values in rc.calendar.holidays.
std::string calendarholidays = context.config.get ("calendar.holidays"); std::string calendarholidays = context.config.get ("calendar.holidays");
@ -369,14 +369,14 @@ int CmdShow::execute (std::string& output)
calendarholidays != "sparse" && calendarholidays != "sparse" &&
calendarholidays != "none") calendarholidays != "none")
out << format (STRING_CMD_SHOW_CONFIG_ERROR, "calendar.holidays", calendarholidays) out << format (STRING_CMD_SHOW_CONFIG_ERROR, "calendar.holidays", calendarholidays)
<< "\n"; << '\n';
// Verify installation. This is mentioned in the documentation as the way // Verify installation. This is mentioned in the documentation as the way
// to ensure everything is properly installed. // to ensure everything is properly installed.
if (context.config.size () == 0) if (context.config.size () == 0)
{ {
out << STRING_CMD_SHOW_EMPTY << "\n"; out << STRING_CMD_SHOW_EMPTY << '\n';
rc = 1; rc = 1;
} }
else else
@ -384,10 +384,10 @@ int CmdShow::execute (std::string& output)
Directory location (context.config.get ("data.location")); Directory location (context.config.get ("data.location"));
if (location._data == "") if (location._data == "")
out << STRING_CMD_SHOW_NO_LOCATION << "\n"; out << STRING_CMD_SHOW_NO_LOCATION << '\n';
if (! location.exists ()) if (! location.exists ())
out << STRING_CMD_SHOW_LOC_EXIST << "\n"; out << STRING_CMD_SHOW_LOC_EXIST << '\n';
} }
output = out.str (); output = out.str ();
@ -418,7 +418,7 @@ int CmdShowRaw::execute (std::string& output)
// Display them all. // Display them all.
std::stringstream out; std::stringstream out;
for (auto& i : all) for (auto& i : all)
out << i << '=' << context.config.get (i) << "\n"; out << i << '=' << context.config.get (i) << '\n';
output = out.str (); output = out.str ();
return 0; return 0;

View file

@ -109,7 +109,7 @@ int CmdStart::execute (std::string&)
} }
else else
{ {
std::cout << STRING_CMD_START_NO << "\n"; std::cout << STRING_CMD_START_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;
@ -120,7 +120,7 @@ int CmdStart::execute (std::string&)
std::cout << format (STRING_CMD_START_ALREADY, std::cout << format (STRING_CMD_START_ALREADY,
task.id, task.id,
task.get ("description")) task.get ("description"))
<< "\n"; << '\n';
rc = 1; rc = 1;
} }
} }

View file

@ -99,7 +99,7 @@ int CmdStop::execute (std::string&)
} }
else else
{ {
std::cout << STRING_CMD_STOP_NO << "\n"; std::cout << STRING_CMD_STOP_NO << '\n';
rc = 1; rc = 1;
if (_permission_quit) if (_permission_quit)
break; break;
@ -110,7 +110,7 @@ int CmdStop::execute (std::string&)
std::cout << format (STRING_CMD_STOP_ALREADY, std::cout << format (STRING_CMD_STOP_ALREADY,
task.identifier (true), task.identifier (true),
task.get ("description")) task.get ("description"))
<< "\n"; << '\n';
rc = 1; rc = 1;
} }
} }

View file

@ -212,11 +212,11 @@ int CmdSummary::execute (std::string& output)
<< view.render () << view.render ()
<< optionalBlankLine (); << optionalBlankLine ();
out << format (STRING_CMD_PROJECTS_SUMMARY2, view.rows ()) << "\n"; out << format (STRING_CMD_PROJECTS_SUMMARY2, view.rows ()) << '\n';
} }
else else
{ {
out << STRING_CMD_PROJECTS_NO << "\n"; out << STRING_CMD_PROJECTS_NO << '\n';
rc = 1; rc = 1;
} }

View file

@ -138,7 +138,7 @@ int CmdSync::execute (std::string& output)
auto all_tasks = context.tdb2.all_tasks (); auto all_tasks = context.tdb2.all_tasks ();
for (auto& i : all_tasks) for (auto& i : all_tasks)
{ {
payload += i.composeJSON () + "\n"; payload += i.composeJSON () + '\n';
++upload_count; ++upload_count;
} }
} }
@ -150,7 +150,7 @@ int CmdSync::execute (std::string& output)
if (i[0] == '{') if (i[0] == '{')
++upload_count; ++upload_count;
payload += i + "\n"; payload += i + '\n';
} }
} }
@ -172,7 +172,7 @@ int CmdSync::execute (std::string& output)
if (context.verbose ("sync")) if (context.verbose ("sync"))
out << format (STRING_CMD_SYNC_PROGRESS, connection) out << format (STRING_CMD_SYNC_PROGRESS, connection)
<< "\n"; << '\n';
// Ignore harmful signals. // Ignore harmful signals.
signal (SIGHUP, SIG_IGN); signal (SIGHUP, SIG_IGN);
@ -227,7 +227,7 @@ int CmdSync::execute (std::string& output)
format (STRING_CMD_SYNC_MOD, format (STRING_CMD_SYNC_MOD,
uuid, uuid,
from_server.get ("description"))) from_server.get ("description")))
<< "\n"; << '\n';
context.tdb2.modify (from_server, false); context.tdb2.modify (from_server, false);
} }
else else
@ -238,7 +238,7 @@ int CmdSync::execute (std::string& output)
format (STRING_CMD_SYNC_ADD, format (STRING_CMD_SYNC_ADD,
uuid, uuid,
from_server.get ("description"))) from_server.get ("description")))
<< "\n"; << '\n';
context.tdb2.add (from_server, false); context.tdb2.add (from_server, false);
} }
} }
@ -259,7 +259,7 @@ int CmdSync::execute (std::string& output)
context.tdb2.backlog._file.truncate (); context.tdb2.backlog._file.truncate ();
context.tdb2.backlog.clear_tasks (); context.tdb2.backlog.clear_tasks ();
context.tdb2.backlog.clear_lines (); context.tdb2.backlog.clear_lines ();
context.tdb2.backlog.add_line (sync_key + "\n"); context.tdb2.backlog.add_line (sync_key + '\n');
// Present a clear status message. // Present a clear status message.
if (upload_count == 0 && download_count == 0) if (upload_count == 0 && download_count == 0)
@ -326,7 +326,7 @@ int CmdSync::execute (std::string& output)
} }
if (context.verbose ("sync")) if (context.verbose ("sync"))
out << "\n"; out << '\n';
output = out.str (); output = out.str ();
// Restore signal handling. // Restore signal handling.
@ -373,7 +373,7 @@ bool CmdSync::send (
client.ciphers (context.config.get ("taskd.ciphers")); client.ciphers (context.config.get ("taskd.ciphers"));
client.init (ca, certificate, key); client.init (ca, certificate, key);
client.connect (server, port); client.connect (server, port);
client.send (request.serialize () + "\n"); client.send (request.serialize () + '\n');
std::string incoming; std::string incoming;
client.recv (incoming); client.recv (incoming);

View file

@ -134,7 +134,7 @@ int CmdTags::execute (std::string& output)
else else
context.footnote (format (STRING_FEEDBACK_TASKS_PLURAL, quantity)); context.footnote (format (STRING_FEEDBACK_TASKS_PLURAL, quantity));
out << "\n"; out << '\n';
} }
else else
{ {
@ -224,7 +224,7 @@ int CmdCompletionTags::execute (std::string& output)
std::stringstream out; std::stringstream out;
for (auto& it : unique) for (auto& it : unique)
out << it.first << "\n"; out << it.first << '\n';
output = out.str (); output = out.str ();
return 0; return 0;

View file

@ -97,9 +97,9 @@ int CmdTimesheet::execute (std::string& output)
if (context.color ()) if (context.color ())
bold = Color ("bold"); bold = Color ("bold");
out << "\n" out << '\n'
<< bold.colorize (title) << bold.colorize (title)
<< "\n"; << '\n';
// Render the completed table. // Render the completed table.
ViewText completed; ViewText completed;
@ -145,10 +145,10 @@ int CmdTimesheet::execute (std::string& output)
std::map <std::string, std::string> annotations; std::map <std::string, std::string> annotations;
task.getAnnotations (annotations); task.getAnnotations (annotations);
for (auto& ann : annotations) for (auto& ann : annotations)
description += "\n" description += '\n'
+ std::string (indent, ' ') + std::string (indent, ' ')
+ ISO8601d (ann.first.substr (11)).toString (context.config.get ("dateformat")) + ISO8601d (ann.first.substr (11)).toString (context.config.get ("dateformat"))
+ " " + ' '
+ ann.second; + ann.second;
completed.set (row, 3, description, c); completed.set (row, 3, description, c);
@ -156,11 +156,11 @@ int CmdTimesheet::execute (std::string& output)
} }
} }
out << " " << format (STRING_CMD_TIMESHEET_DONE, completed.rows ()) << "\n"; out << " " << format (STRING_CMD_TIMESHEET_DONE, completed.rows ()) << '\n';
if (completed.rows ()) if (completed.rows ())
out << completed.render () out << completed.render ()
<< "\n"; << '\n';
// Now render the started table. // Now render the started table.
ViewText started; ViewText started;
@ -201,10 +201,10 @@ int CmdTimesheet::execute (std::string& output)
std::map <std::string, std::string> annotations; std::map <std::string, std::string> annotations;
task.getAnnotations (annotations); task.getAnnotations (annotations);
for (auto& ann : annotations) for (auto& ann : annotations)
description += "\n" description += '\n'
+ std::string (indent, ' ') + std::string (indent, ' ')
+ ISO8601d (ann.first.substr (11)).toString (context.config.get ("dateformat")) + ISO8601d (ann.first.substr (11)).toString (context.config.get ("dateformat"))
+ " " + ' '
+ ann.second; + ann.second;
started.set (row, 3, description, c); started.set (row, 3, description, c);
@ -212,7 +212,7 @@ int CmdTimesheet::execute (std::string& output)
} }
} }
out << " " << format (STRING_CMD_TIMESHEET_STARTED, started.rows ()) << "\n"; out << " " << format (STRING_CMD_TIMESHEET_STARTED, started.rows ()) << '\n';
if (started.rows ()) if (started.rows ())
out << started.render () out << started.render ()

View file

@ -128,11 +128,11 @@ int CmdUDAs::execute (std::string& output)
<< (udas.size () == 1 << (udas.size () == 1
? format (STRING_CMD_UDAS_SUMMARY, udas.size ()) ? format (STRING_CMD_UDAS_SUMMARY, udas.size ())
: format (STRING_CMD_UDAS_SUMMARY2, udas.size ())) : format (STRING_CMD_UDAS_SUMMARY2, udas.size ()))
<< "\n"; << '\n';
} }
else else
{ {
out << STRING_CMD_UDAS_NO << "\n"; out << STRING_CMD_UDAS_NO << '\n';
rc = 1; rc = 1;
} }
@ -173,7 +173,7 @@ int CmdUDAs::execute (std::string& output)
<< (udas.size () == 1 << (udas.size () == 1
? format (STRING_CMD_UDAS_ORPHAN, orphans.size ()) ? format (STRING_CMD_UDAS_ORPHAN, orphans.size ())
: format (STRING_CMD_UDAS_ORPHANS, orphans.size ())) : format (STRING_CMD_UDAS_ORPHANS, orphans.size ()))
<< "\n"; << '\n';
} }
output = out.str (); output = out.str ();
@ -215,7 +215,7 @@ int CmdCompletionUDAs::execute (std::string& output)
{ {
std::sort (udas.begin (), udas.end ()); std::sort (udas.begin (), udas.end ());
join (output, "\n", udas); join (output, "\n", udas);
output += "\n"; output += '\n';
} }
return 0; return 0;

View file

@ -87,7 +87,7 @@ int CmdUnique::execute (std::string& output)
// Generate list of unique values. // Generate list of unique values.
for (auto& value : values) for (auto& value : values)
output += value + "\n"; output += value + '\n';
context.headers.clear (); context.headers.clear ();
return 0; return 0;

View file

@ -74,7 +74,7 @@ int CmdUrgency::execute (std::string& output)
out << format (STRING_CMD_URGENCY_RESULT, out << format (STRING_CMD_URGENCY_RESULT,
task.identifier (), task.identifier (),
Lexer::trim (format (task.urgency (), 6, 3))) Lexer::trim (format (task.urgency (), 6, 3)))
<< "\n"; << '\n';
} }
output = out.str (); output = out.str ();

View file

@ -76,7 +76,7 @@ int CmdVersion::execute (std::string& output)
if (context.color ()) if (context.color ())
bold = Color ("bold"); bold = Color ("bold");
out << "\n" out << '\n'
<< format (STRING_CMD_VERSION_BUILT, bold.colorize (PACKAGE), bold.colorize (VERSION)) << format (STRING_CMD_VERSION_BUILT, bold.colorize (PACKAGE), bold.colorize (VERSION))
#if defined (DARWIN) #if defined (DARWIN)
@ -104,23 +104,23 @@ int CmdVersion::execute (std::string& output)
#endif #endif
#if PACKAGE_LANGUAGE != LANGUAGE_ENG_USA #if PACKAGE_LANGUAGE != LANGUAGE_ENG_USA
<< " " << ' '
<< STRING_LOCALIZATION_DESC << STRING_LOCALIZATION_DESC
#endif #endif
<< "\n" << '\n'
<< STRING_CMD_VERSION_COPY << STRING_CMD_VERSION_COPY
<< "\n" << '\n'
<< "\n" << '\n'
<< disclaimer.render () << disclaimer.render ()
<< "\n" << '\n'
<< link.render () << link.render ()
<< "\n"; << '\n';
#if PACKAGE_LANGUAGE != LANGUAGE_ENG_USA #if PACKAGE_LANGUAGE != LANGUAGE_ENG_USA
out << STRING_LOCALIZATION_AUTHOR out << STRING_LOCALIZATION_AUTHOR
<< "\n" << '\n'
<< "\n"; << '\n';
#endif #endif
output = out.str (); output = out.str ();
@ -154,7 +154,7 @@ int CmdCompletionVersion::execute (std::string& output)
#else #else
output = VERSION; output = VERSION;
#endif #endif
output += "\n"; output += '\n';
return 0; return 0;
} }

View file

@ -350,7 +350,7 @@ bool Command::permission (
return true; return true;
if (context.verbose ("blank") && !_first_iteration) if (context.verbose ("blank") && !_first_iteration)
std::cout << "\n"; std::cout << '\n';
int answer = confirm4 (question); int answer = confirm4 (question);
_first_iteration = false; _first_iteration = false;
switch (answer) switch (answer)

View file

@ -67,7 +67,6 @@ void dependencyGetBlocking (const Task& task, std::vector <Task>& blocking)
// Returns true if the supplied task adds a cycle to the dependency chain. // Returns true if the supplied task adds a cycle to the dependency chain.
bool dependencyIsCircular (const Task& task) bool dependencyIsCircular (const Task& task)
{ {
// A new task has no UUID assigned yet, and therefore cannot be part of any // A new task has no UUID assigned yet, and therefore cannot be part of any
// dependency chain. // dependency chain.
if (task.has ("uuid")) if (task.has ("uuid"))
@ -163,7 +162,7 @@ void dependencyChainOnComplete (Task& task)
<< "\n"; << "\n";
for (auto& b : blocking) for (auto& b : blocking)
std::cout << " " << b.id << " " << b.get ("description") << "\n"; std::cout << " " << b.id << ' ' << b.get ("description") << "\n";
} }
// If there are both blocking and blocked tasks, the chain is broken. // If there are both blocking and blocked tasks, the chain is broken.
@ -175,7 +174,7 @@ void dependencyChainOnComplete (Task& task)
<< "\n"; << "\n";
for (auto& b : blocked) for (auto& b : blocked)
std::cout << " " << b.id << " " << b.get ("description") << "\n"; std::cout << " " << b.id << ' ' << b.get ("description") << "\n";
} }
if (!context.config.getBoolean ("dependency.confirmation") || if (!context.config.getBoolean ("dependency.confirmation") ||
@ -218,7 +217,7 @@ void dependencyChainOnStart (Task& task)
<< "\n"; << "\n";
for (auto& b : blocking) for (auto& b : blocking)
std::cout << " " << b.id << " " << b.get ("description") << "\n"; std::cout << " " << b.id << ' ' << b.get ("description") << "\n";
} }
} }
} }

View file

@ -478,7 +478,7 @@ std::string onProjectChange (Task& task, bool scope /* = true */)
percentage = (count_done * 100 / (count_done + count_pending)); percentage = (count_done * 100 / (count_done + count_pending));
msg << format (STRING_HELPER_PROJECT_COMPL, project, percentage) msg << format (STRING_HELPER_PROJECT_COMPL, project, percentage)
<< " "; << ' ';
if (count_pending == 1 && count_done == 0) if (count_pending == 1 && count_done == 0)
msg << format (STRING_HELPER_PROJECT_REM1, count_pending); msg << format (STRING_HELPER_PROJECT_REM1, count_pending);