Skip to content

Commit fd14076

Browse files
authored
Update UnParserExtensions.cs
If there is no long name, take the short name regardless of the preference setting
1 parent caa48c2 commit fd14076

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/CommandLine/UnParserExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,10 @@ private static string FormatOption(OptionSpecification spec, object value, UnPar
206206

207207
private static string FormatName(this OptionSpecification optionSpec, UnParserSettings settings)
208208
{
209-
// Short name not preferred? Go with long! No short name? Has to be long!
210-
var longName = !settings.PreferShortName || optionSpec.ShortName.Length == 0;
209+
// Have a long name and short name not preferred? Go with long!
210+
// No short name? Has to be long!
211+
var longName = (optionSpec.LongName.Length > 0 && !settings.PreferShortName)
212+
|| optionSpec.ShortName.Length == 0;
211213

212214
return
213215
new StringBuilder(longName

0 commit comments

Comments
 (0)