Enhancement

- Output error, header, footnote and debug messages on standard error.
This commit is contained in:
Louis-Claude Canon 2012-06-15 21:16:06 +02:00 committed by Paul Beckingham
parent b093d23f1f
commit b45a305df2
28 changed files with 101 additions and 82 deletions

View file

@ -147,7 +147,6 @@ int CmdCustom::execute (std::string& output)
if (maxlines)
maxlines -= (context.verbose ("blank") ? 1 : 0)
+ table_header
+ (context.verbose ("footnote") ? context.footnotes.size () : 0)
+ 1; // "X tasks shown ..."
// Render.
@ -161,6 +160,7 @@ int CmdCustom::execute (std::string& output)
<< view.render (filtered, sequence)
<< optionalBlankLine ();
// Print the number of rendered tasks
if (context.verbose ("affected"))
{
out << (filtered.size () == 1

View file

@ -691,7 +691,7 @@ ARE_THESE_REALLY_HARMFUL:
if (oops)
{
std::cout << STRING_ERROR_PREFIX << problem << "\n";
std::cerr << STRING_ERROR_PREFIX << problem << "\n";
// Preserve the edits.
before = after;

View file

@ -89,7 +89,22 @@ int CmdMerge::execute (std::string& output)
else
file = uri._path;
context.tdb2.merge (file);
// XXX the following function could indicate whether a modification was
// performed without an exception (by returning a boolean, within a status
// object or with a specific function)
try
{
context.tdb2.merge (file);
}
catch (std::string& e) {
if (e == STRING_TDB2_UP_TO_DATE)
{
output += e + "\n";
return 0;
}
else
throw e;
}
output += std::string (STRING_CMD_MERGE_COMPLETE) + "\n";

View file

@ -113,7 +113,7 @@ int CmdShell::execute (std::string&)
catch (std::string& error)
{
std::cout << error << "\n";
std::cerr << error << "\n";
}
catch (...)