Utils: Fix UsageInformation still outputting a dash when no short name is specified. Same for long name.

This commit is contained in:
Jan 2019-12-30 23:51:13 +01:00
parent af55c202cf
commit 5f833969f9

View File

@ -88,14 +88,18 @@ void UsageInformation::Print()
for (auto option : category.second)
{
str << std::setw(longestShortName + 1) << "-" + option->m_short_name;
str << std::setw(static_cast<std::streamsize>(longestShortName) + 1) << (!option->m_short_name.empty()
? "-" + option->m_short_name
: "");
if (!option->m_short_name.empty() && !option->m_long_name.empty())
str << ", ";
else
str << " ";
str << std::setw(longestLongName + 2) << "--" + option->m_long_name;
str << std::setw(static_cast<std::streamsize>(longestLongName) + 2) << (!option->m_long_name.empty()
? "--" + option->m_long_name
: "");
str << " ";
str << std::setw(longestArgumentLength) << GetOptionArgument(option);