-
Notifications
You must be signed in to change notification settings - Fork 286
Display A Help Screen
gsscoder edited this page May 22, 2012
·
35 revisions
Mapping a method with HelpOptionAttribute will allow the parser to display a help screen when parsing rule are violated.
class Options
{
[Option("p", "person-to-greet", Required=true, HelpText="The person to greet.")]
public string PersonToGreet { get; set; }
[HelpOption]
public string GetUsage()
{
return "Please read user manual!" + Environment.NewLine;
}
}In this sample the -p|--person-to-great option is mandatory. Omitting it will cause the parser to display the string returned by Options::GetUsage().
[TO BE COMPLETED...]