Announcing NDesk.Options 0.1.0 - Jonathan Pryor's web log
« Mono and Mixed Mode Assembly Support | Main | Unix Signal Handling In C# »
Announcing NDesk.Options 0.1.0
I am pleased to announce the release of NDesk.Options 0.1.0. NDesk.Options is a C# program option parser library, inspired by Perl's Getopt::Long option parser.
To download, visit the NDesk.Options web page:
http://www.ndesk.org/Options
Usage
See http://www.ndesk.org/Options and the OptionSet documentation for examples.
What's New?
There have been numerous changes since the previous prototype release:
- Full member documentation.
- All errors are reported via OptionException.
- Options has been renamed to OptionSet.
- OptionSet.Parse(IEnumerable<string>) now returns a List<string> instead of an IEnumerable<string>.
- When a registered option follows an option requiring a value, the
registered option is used as the option value instead of triggering an
error. Thus:
var p = new OptionSet () { { "-n=", v => { /* ignore */ } }, { "-v", v => { /* ignore */ } }, }; p.Parse (new string[]{"-n", "-v"});
would previously have triggered an exception, but now uses -v as the value of the -n option. This is consistent with Getopt::Long.
- TypeConverter exceptions are now wrapped within an OptionException, and the Message property contains a useful error message.
- OptionException message localization support.
- Add a OptionContext class that provides contextual information about the current option.
- Add a set of OptionSet.Add() methods that have callbacks that accept an OptionContext parameter.
- Add a set of virtual methods to Option and OptionSet to permit use by subclasses. The OptionSet class-level documentation has an example.