This C++ template formats and prints tabular data. It calculates column widths after all fields are known. The following snippet shows typical usage:
CPrettyTable<int, const char*, double> tbl("num", "name", "score");
for (int i = 0; i < 5; ++i) {
tbl.Add(i + 1, "FooBar", 2.5 * (i + 1));
}
tbl.SetCaption("FooBar");
tbl.Dump(std::cerr);The code prints the following output to the standard error stream:
+-----+[ FooBar ]------+
| num | name | score |
+-----+--------+-------+
| 1 | FooBar | 2.5 |
| 2 | FooBar | 5 |
| 3 | FooBar | 7.5 |
| 4 | FooBar | 10 |
| 5 | FooBar | 12.5 |
+-----+--------+-------+redo test runs unit tests.
redo lint runs the following linters on the source files:
actionlint,
checkmake,
reuse,
shellcheck,
shfmt,
typos,
yamllint.
ptable is copyrighted by David Rabkin and available under the
Zero-Clause BSD license.