This release (18.104.22.168 beta 2) introduces mutually exclusive options, fixes reported bugs and turns into reality many user requests (see Discussions and Issue Tracker).
- Parsing no value or null string (in case of string option) fails, with the result of returning false from ParseArguements(...)
- The type ParserSettings
was renamed with a more consistent CommandLineParserSettings
. Now is coupled with the main implementation of ICommandLineParser
) and decoupled from this interface. A new boolean property was added, named MutuallyExclusive
, for enable or disable the rule that governs the relative feature.
- The attribute type OptionAttribute
(and derived types
) has a new string property MutullyExclusiveSet (see bool CommandLineParserSettings::MutuallyExclusive
- It's now possible to specify a single dash
(-) as non option input argument. Some programs (e.g.: unix tool tar
) use this token for specify STDIN
- With void HelpText::AddPostOptionsLine(string)
you can now add text lines at the end of the help text buffer (after the options block, if present).
Download the documentation package
for a detailed API guide (it contains a CHM
Mutually Exclusive Options
The main feature introduced with this version is the possibility to define multiple set of mutually exclusive options.
For use this feature, as first thing, you must enable it:
CommandLineParserSettings settings = new CommandLineParserSettings();
settings.MutuallyExclusive = true;
Then create your parser instance:
ICommandLineParser parser = new CommandLineParser(settings);
Define your options class
as you normally do, just use the new property:
HelpText = "This is a sample option, included in a small tutorial.",
MutuallyExclusiveSet = "SampleSet")]
public bool HaveFunWithThisFeature;
You can also set MutuallyExclusiveSet to null (or string.Empty) and the library will assign automaticcally a name (this is useful when you want define only one set).Note
: The consistency check of mutually exclusiveness is done inside each set.
For more samples you can view the unit test relative to this feature, read MutuallyExclusiveParsingFixture.cs
Reverting to beta
status may break compatibility with previous stable
release. It is also not guaranteed that next version will keep changes introduced here with the same design (but in case of a beta 2
, like this, is highly probable).
See the section of change log
relative to this release.