CommandLineParser.HelpRequested Property

Gets or sets a value that indicates whether usage help should be displayed if the Parse(String[]) method returned null.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.2.0+a4d3631e4dcc0970081ed435288efdebc1325f83
C#
public bool HelpRequested { get; set; }

Property Value

Boolean
true if usage help should be displayed; otherwise, false.

Remarks

Check this property after calling the Parse(String[]) method or one of its overloads to see if usage help should be displayed.

This property will always be false if the Parse(String[]) method returned a non-null value.

This property will always be true if the Parse(String[]) method threw a CommandLineArgumentException, or if an argument used CancelMode.Abort with the CommandLineArgumentAttribute.CancelParsing property or the ArgumentParsed event.

If an argument that is defined by a method (ArgumentKind.Method) cancels parsing by returning CancelMode.Abort or false from the method, this property is not automatically set to true. Instead, the method should explicitly set the HelpRequested property if it wants usage help to be displayed.

C#
[CommandLineArgument]
public static CancelMode MethodArgument(CommandLineParser parser)
{
    parser.HelpRequested = true;
    return CancelMode.Abort;
}

See Also