CommandLineParser.HelpRequested Property

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

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 3.1.1
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[], Int32) method to see if usage help should be displayed.

This property will be true if the Parse(String[], Int32) method threw a CommandLineArgumentException, if an argument used CancelParsing, if parsing was canceled using the ArgumentParsed event.

If an argument that is defined by a method (Method) cancels parsing by returning 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 bool MethodArgument(CommandLineParser parser)
{
    parser.HelpRequested = true;
    return false;
}

The HelpRequested property will always be false if Parse(String[], Int32) did not throw and returned a non-null value.

See Also