mirror of
https://github.com/NixOS/nix.git
synced 2025-12-12 20:11:03 +01:00
printTable(): Make destination stream explicit
This commit is contained in:
parent
ab6dcf2047
commit
c4dc42f306
3 changed files with 6 additions and 6 deletions
|
|
@ -6,6 +6,6 @@ namespace nix {
|
|||
|
||||
typedef std::vector<std::vector<std::string>> Table;
|
||||
|
||||
void printTable(Table & table);
|
||||
void printTable(std::ostream & out, Table & table);
|
||||
|
||||
} // namespace nix
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
void printTable(Table & table)
|
||||
void printTable(std::ostream & out, Table & table)
|
||||
{
|
||||
auto nrColumns = table.size() > 0 ? table.front().size() : 0;
|
||||
|
||||
|
|
@ -27,11 +27,11 @@ void printTable(Table & table)
|
|||
for (auto j = i.begin(); j != i.end(); ++j, ++column) {
|
||||
std::string s = *j;
|
||||
replace(s.begin(), s.end(), '\n', ' ');
|
||||
std::cout << s;
|
||||
out << s;
|
||||
if (column < nrColumns - 1)
|
||||
std::cout << std::string(widths[column] - s.size() + 2, ' ');
|
||||
out << std::string(widths[column] - s.size() + 2, ' ');
|
||||
}
|
||||
std::cout << std::endl;
|
||||
out << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1250,7 +1250,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
|
|||
}
|
||||
|
||||
if (!xmlOutput)
|
||||
printTable(table);
|
||||
printTable(std::cout, table);
|
||||
}
|
||||
|
||||
static void opSwitchProfile(Globals & globals, Strings opFlags, Strings opArgs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue