gsscoder/commandline

Verb fails if option has no long name

lucaghersi opened this issue · 0 comments

Using the verbs I noticed that the verb commmand fails with a System.ArgumentNullException if the long name for an option is not set. If you set the long name everything works fine.

So, if you use an option like this

[Option('v', null, HelpText = "Print details during execution.")]
public bool Verbose { get; set; }

you get this:

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: longName
at CommandLine.OptionAttribute..ctor(String shortName, String longName)
at CommandLine.OptionAttribute..ctor(Char shortName, String longName)

calling "program VERBNAME" or "program help VERBNAME"