mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-07 04:02:23 +03:00
cmCMakePresetsGraph: use std::setw instead of for-loop + one space at time
This commit is contained in:
1 parent
43a18bfaee
commit
0bf8df384c
1 file changed
+8
-7
@@ -4,8 +4,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
@@ -1365,15 +1365,16 @@ void cmCMakePresetsGraph::PrintPresets(
|
||||
auto longestLength = (*longestPresetName)->Name.length();
|
||||
|
||||
for (auto const* preset : presets) {
|
||||
std::cout << " \"" << preset->Name << '"';
|
||||
auto name = cmStrCat(" \"", preset->Name, '"');
|
||||
auto const& description = preset->DisplayName;
|
||||
if (!description.empty()) {
|
||||
for (std::size_t i = 0; i < longestLength - preset->Name.length(); ++i) {
|
||||
std::cout << ' ';
|
||||
}
|
||||
std::cout << " - " << description;
|
||||
int const width = static_cast<int>(longestLength + name.length() -
|
||||
preset->Name.length());
|
||||
std::cout << std::left << std::setw(width) << name << " - "
|
||||
<< description << '\n';
|
||||
} else {
|
||||
std::cout << name << '\n';
|
||||
}
|
||||
std::cout << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user