Commits

Mathias Panzenböck committed 79d2e6a

nicer --coverage output

Comments (0)

Files changed (2)

unvpk/src/console_table.cpp

 	for (Table::const_iterator i = m_body.begin(); i != m_body.end(); ++ i) {
 		const Row &row = *i;
 		for (size_t j = 0, n = row.size(); j < n; ++ j) {
-			align(os, row[j], colsizes[j], alignments[j]);
-			if (j + 1 < n) os.put(' ');
+			if (j + 1 < n) {
+				align(os, row[j], colsizes[j], alignments[j]);
+				os.put(' ');
+			}
+			else {
+				align(os, row[j], row[j].size(), alignments[j]);
+			}
 		}
 		os.put('\n');
 	}

unvpk/src/main.cpp

 		create_path(destdir);
 	}
 
+	ConsoleTable statsTbl;
+	statsTbl.columns(ConsoleTable::LEFT, ConsoleTable::RIGHT, ConsoleTable::RIGHT, ConsoleTable::RIGHT, ConsoleTable::RIGHT);
+	statsTbl.row("File", "Size", "Covered", "%", "Missing", "Missing Areas");
+
 	size_t uncovered = 0;
 	size_t total = 0;
 	const size_t magicSize = Magic::maxSize();
 		size_t coveredSize = covered.coverage();
 		std::string coveredSizeStr = sizeToString(coveredSize, humanreadable);
 
-		std::cout
-			<< (boost::format(
-				"File: %s\n"
-				"Size: %s\n"
-				"Covered: %s (%.0lf%%)\n"
-				"Missing: %s\n"
-				"Missing Areas:\n"
-				"\t%s\n\n")
-				% archive % sizeStr % coveredSizeStr % (covered.coverage() * (double)100 / size)
-				% missingSizeStr % missing.str(humanreadable));
+		statsTbl.row(archive, sizeStr, coveredSizeStr,
+			boost::format("%.0lf%%") % (covered.coverage() * (double)100 / size),
+			missingSizeStr, missing.str(humanreadable));
 
 		if (dump) {
 			std::string prefix = (destdir / archive).string();
 	std::string coveredStr = sizeToString(covered, humanreadable);
 	std::string uncoveredStr = sizeToString(uncovered, humanreadable);
 
+	statsTbl.print(std::cout);
+
 	std::cout
-		<< (boost::format(
+		<< (boost::format("\n"
 			"Total Size: %s\n"
 			"Total Covered: %s (%.0lf%%)\n"
 			"Total Missing: %s\n")