Skip to content

Commit b000bf9

Browse files
committed
Fix formatting of short-only options.
Fixes #4644. [SVN r65645]
1 parent 7d7dad0 commit b000bf9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/options_description.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,13 @@ namespace boost { namespace program_options {
174174
option_description::format_name() const
175175
{
176176
if (!m_short_name.empty())
177-
return string(m_short_name).append(" [ --").
178-
append(m_long_name).append(" ]");
179-
else
180-
return string("--").append(m_long_name);
177+
{
178+
return m_long_name.empty()
179+
? m_short_name
180+
: string(m_short_name).append(" [ --").
181+
append(m_long_name).append(" ]");
182+
}
183+
return string("--").append(m_long_name);
181184
}
182185

183186
std::string

0 commit comments

Comments
 (0)