Skip to content

Commit 57e8ebd

Browse files
committed
support shortname only command #51
1 parent 0e54985 commit 57e8ebd

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/ConsoleAppFramework/CommandHelpBuilder.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ public CommandHelpDefinition CreateCommandHelpDefinition(MethodInfo method)
294294
else
295295
{
296296
// If Index is -1, ShortName is initialized at Constractor.
297-
options.Add($"-{option.ShortName!.Trim('-')}");
297+
if (option.ShortName != null)
298+
{
299+
options.Add($"-{option.ShortName.Trim('-')}");
300+
}
298301
}
299302
}
300303

src/ConsoleAppFramework/OptionAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public OptionAttribute(string shortName)
2828
this.Description = null;
2929
}
3030

31-
public OptionAttribute(string shortName, string description)
31+
public OptionAttribute(string? shortName, string description)
3232
{
3333
this.Index = -1;
3434
this.ShortName = shortName;

0 commit comments

Comments
 (0)