summaryrefslogtreecommitdiffstats
path: root/src/common/TextTable.cc
diff options
context:
space:
mode:
authorSage Weil <sage@redhat.com>2020-02-19 23:53:40 +0100
committerSage Weil <sage@redhat.com>2020-02-25 02:52:31 +0100
commit41f003518a070f5518a1b729fc3596a1b7689533 (patch)
tree9a2b47424f6e2be797e0da94abab6daeed7a4541 /src/common/TextTable.cc
parentmgr/status: align with ceph table style (diff)
downloadceph-41f003518a070f5518a1b729fc3596a1b7689533.tar.xz
ceph-41f003518a070f5518a1b729fc3596a1b7689533.zip
common/TextTable: only pad between columns
No need to pad on the right-hand side if there are no additional columns that follow. Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/common/TextTable.cc')
-rw-r--r--src/common/TextTable.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/common/TextTable.cc b/src/common/TextTable.cc
index 8973c9e756c..e17e7eb8d1c 100644
--- a/src/common/TextTable.cc
+++ b/src/common/TextTable.cc
@@ -68,18 +68,22 @@ std::ostream &operator<<(std::ostream &out, const TextTable &t)
{
for (unsigned int i = 0; i < t.col.size(); i++) {
TextTable::TextTableColumn col = t.col[i];
+ if (i) {
+ out << t.column_separation;
+ }
out << string(t.indent, ' ')
- << pad(col.heading, col.width, col.hd_align)
- << t.column_separation;
+ << pad(col.heading, col.width, col.hd_align);
}
out << endl;
for (unsigned int i = 0; i < t.row.size(); i++) {
for (unsigned int j = 0; j < t.row[i].size(); j++) {
TextTable::TextTableColumn col = t.col[j];
+ if (j) {
+ out << t.column_separation;
+ }
out << string(t.indent, ' ')
- << pad(t.row[i][j], col.width, col.col_align)
- << t.column_separation;
+ << pad(t.row[i][j], col.width, col.col_align);
}
out << endl;
}