Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/CommandLineUtils/Attributes/OptionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ internal CommandOption Configure(CommandLineApplication app, PropertyInfo prop)
LongName = longName,
ShortName = longName.Substring(0, 1),
ValueName = prop.Name.ToConstantCase(),
UnderlyingType = prop.PropertyType,
};
}

option.UnderlyingType = prop.PropertyType;

Configure(option);

option.Description ??= prop.Name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ SomeNullableEnumArgument nullable enum arg desc.
Allowed values are: None, Normal, Extreme.
-enumOpt4|--verb4[:<VERB4>] nullable enum option desc.
Allowed values are: None, Normal, Extreme.
-enumOpt5|--verb5 <VERB5> enum option desc.
Allowed values are: None, Normal, Extreme.
Default value is: None.
-?|-h|--help Show help information.

",
Expand Down Expand Up @@ -255,6 +258,9 @@ public class MyApp
[Option(CommandOptionType.SingleOrNoValue, ShortName = "enumOpt4", Description = "nullable enum option desc.")]
public SomeEnum? Verb4 { get; set; }

[Option("-enumOpt5 | --verb5 <VERB5>", Description = "enum option desc.")]
public SomeEnum Verb5 { get; set; }

[Argument(0, Description = "string arg desc.")]
public string SomeStringArgument { get; set; }

Expand Down