Friday, 20 July 2007

Command Line Library Minor Update (1.2.7.0)

This release replaces the need of inheriting from ValueContainer class with the use of the new ValueListAttribute. This levels the programming model making the OO design more coherent.
As can use the OptionAttribute for define an option to parse:

class Options {

[Option ("o", "output")]
public string OutputFilename;
}

Now you can use the ValueListAttribute to store non-option values:

class Options {

[Option ("o", "output")]
public string OutputFilename;

[ValueList (typeof (List<string>))]
public IList<string> InputFilenames;
}

You must apply this new attribute to a field defined as IList<string> and define a compatible concrete instance type for the attribute constructor. This allows a good degree of customization without making more complex the programming model.
The release also features some internal rectoring and thread safety when modifying the options instance.

Give it a try.

No comments:

Post a Comment