CommandLineArgumentAttributeCancelParsing Property

Gets or sets a value that indicates whether argument parsing should be canceled if this argument is encountered.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public CancelMode CancelParsing { get; set; }

Property Value

CancelMode
One of the values of the CancelMode enumeration.

Remarks

If this property is not CancelModeNone, the CommandLineParser will stop parsing the command line arguments after seeing this argument. The result of the operation will be if this property is CancelModeAbort, or an instance of the arguments class with the results up to this point if this property is CancelModeSuccess. In the latter case, the ParseResultRemainingArguments property will contain all arguments that were not parsed.

If CancelModeSuccess is used, all required arguments must have a value at the point this argument is encountered, otherwise a CommandLineArgumentException is thrown.

Use the ParseResultArgumentName property to determine which argument caused cancellation.

If this property is CancelModeAbort, the CommandLineParserHelpRequested property will be automatically set to when parsing is canceled.

It's possible to prevent cancellation when an argument has this property set by handling the CommandLineParserArgumentParsed event and setting the ArgumentParsedEventArgsCancelParsing property to CancelModeNone.

See Also