MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / table

Function table

src/commandline.cpp:28–47  ·  view source on GitHub ↗

formats the list of pairs in two columns

Source from the content-addressed store, hash-verified

26// formats the list of pairs in two columns
27//
28std::string table(const std::vector<std::pair<std::string, std::string>>& v,
29 std::size_t indent, std::size_t spacing)
30{
31 std::size_t longest = 0;
32
33 for (auto&& p : v)
34 longest = std::max(longest, p.first.size());
35
36 std::string s;
37
38 for (auto&& p : v) {
39 if (!s.empty())
40 s += "\n";
41
42 s += std::string(indent, ' ') + pad_right(p.first, longest) + " " +
43 std::string(spacing, ' ') + p.second;
44 }
45
46 return s;
47}
48
49CommandLine::CommandLine() : m_command(nullptr)
50{

Callers 1

usageMethod · 0.85

Calls 3

pad_rightFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected