CommandLineParser.AllowWhiteSpaceValueSeparator Property

Gets value indicating whether the value of an argument may be in a separate argument from its name.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 3.1.1
C#
public bool AllowWhiteSpaceValueSeparator { get; }

Property Value

Boolean
true if names and values can be in separate arguments; false if the character specified in the NameValueSeparator property must be used. The default value is true.

Remarks

If the AllowWhiteSpaceValueSeparator property is true, the value of an argument can be separated from its name either by using the character specified in the NameValueSeparator property or by using white space (i.e. by having a second argument that has the value). Given a named argument named "Sample", the command lines -Sample:value and -Sample value are both valid and will assign the value "value" to the argument.

If the AllowWhiteSpaceValueSeparator property is false, only the character specified in the NameValueSeparator property is allowed to separate the value from the name. The command line -Sample:value still assigns the value "value" to the argument, but for the command line "-Sample value" the argument is considered not to have a value (which is only valid if IsSwitch is true), and "value" is considered to be the value for the next positional argument.

For switch arguments (the IsSwitch property is true), only the character specified in the NameValueSeparator property is allowed to specify an explicit value regardless of the value of the AllowWhiteSpaceValueSeparator property. Given a switch argument named "Switch" the command line -Switch false is interpreted to mean that the value of "Switch" is true and the value of the next positional argument is "false", even if the AllowWhiteSpaceValueSeparator property is true.

Use the ParseOptions or ParseOptionsAttribute class to change this value.

See Also