Support optional value when named argument is provided.
nemec opened this issue · 0 comments
nemec commented
When a property has a reference or nullable type, it should be possible for the user to specify that the value is optional (zero or one arguments) without turning that property into a list.
This way you could have an option that enables a server on a given port:
class Options
{
[NamedArgument('s', "server", Constraint=NumArgsConstraint.Optional)]
public int Server { get; set; }
}
--server // default port
--server 1234 // set port
With a constraint like that, we should verify that NumArgs wasn't explicitly set too.