Commit 71afbe35 authored by David Flynn's avatar David Flynn
Browse files

po-lite: improve help & error output formatting

The following cosmetic changes are made:

 - tidy output of error/warning reporting without location context

 - help: fix minimum spacing between options and help text

 - help: add blank line before options whose text collide with help text
   to improve general readability

 - help: widen the options column to reduce number of overlaps



git-svn-id: http://wg11.sc29.org/svn/repos/MPEG-I/Part5-PointCloudCompression/TM/TMC3/trunk@1314 94298a81-5874-47c9-aab8-bfb24faeed7f
parent f932882b
......@@ -54,13 +54,21 @@ namespace df
ostream& ErrorReporter::error(const string& where)
{
is_errored = 1;
cerr << where << " error: ";
if (!where.empty())
cerr << where << " error: ";
else
cerr << "Error: ";
return cerr;
}
ostream& ErrorReporter::warn(const string& where)
{
cerr << where << " warning: ";
if (!where.empty())
cerr << where << " warning: ";
else
cerr << "Warning: ";
return cerr;
}
......@@ -165,7 +173,7 @@ namespace df
max_width = max(max_width, (unsigned) line.tellp());
}
unsigned opt_width = min(max_width+2, 28u + pad_short) + 2;
unsigned opt_width = min(max_width+2, 7+28u + pad_short) + 2;
unsigned desc_width = columns - opt_width;
/* second pass: write out formatted option and help text.
......@@ -187,10 +195,12 @@ namespace df
continue;
}
size_t currlength = size_t(line.tellp());
if (currlength > opt_width)
if (currlength >= opt_width)
{
/* if option text is too long (and would collide with the
* help text, split onto next line */
* help text, split onto next line and ensure a gap after
* the previous option to increase readability */
cout << endl;
line << endl;
currlength = 0;
}
......
......@@ -64,8 +64,8 @@ namespace df
{
ErrorReporter() : is_errored(0) {}
virtual ~ErrorReporter() {}
virtual std::ostream& error(const std::string& where);
virtual std::ostream& warn(const std::string& where);
virtual std::ostream& error(const std::string& where = "");
virtual std::ostream& warn(const std::string& where = "");
bool is_errored;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment