Parser configuration options

Go back


Command line parser’s behavior may be altered with CliParserFlags:

// You may specify flags when creating an instance of parser
var parser = CliParser.NewSimpleParser(flags: CliParserFlags.Default);
// or set flags later
parser.Flags(CliParserFlags.Default);

Supported flags

Flag Value Effect
IgnoreUnknownOptions 1 Parser will not fail on unknown options when flag is set
AllowFreeArguments 2 Parser will not fail on unconsumed arguments when flag is set
PosixNotation 4 Enabled POSIX style parsing (see below)
WindowsNotation 8 Enabled Windows/DOS style parsing (see below)
ColonSeparatedValues 16 Enables color-separated options (see below)
EqualitySignSeparatedValues 32 Enables equality sign-separated options (see below)

By default, only PosixNotation and EqualitySignSeparatedValues flags are set.

Option styles

Command line options have a name and an value. There are few ways to separate them.

Space-separated option

Most general option style is space-separation option. This means that option name and option value are separated with a whitespace:

--key value

This style cannot be disabled.

Colon-separated options

You may use a color (:) sign to separate option’s name from it’s value:

--key:value

Equality sign-separated options

You may use an equality sign (=) sign to separate option’s name from it’s value:

--key=value

POSIX notation

Parser supports POSIX notation with following features:

Windows/DOS notation

Parser supports Windows/DOS notation with following features:

Note than both POSIX and Windows/DOX notations may be enabled simultaneously.