Skip to content

0.5.0 - Enum Binding!

Compare
Choose a tag to compare
@xforever1313 xforever1313 released this 11 Apr 20:41
· 33 commits to master since this release

With 0.5.0, we released an EnumArgumentAttribute. This allows one to limit argument choices to a specific enum. In addition, printing out the description includes all the values within an enum. We also allow parsing an enum while ignoring casing.

Any enum can be used as long as the following rules are, well, followed:

  • The enum must contain at least 1 value within it.
  • If the Required attribute is set to false on the attribute, the enum must have a value set to 0. 0 is the default value for an enum, and its the only way we can define a default enum value with Attribute objects.
  • If IgnoreCase is set to true, but there can not be 2 or enum values that, when casing is ignored, match.

Please see our tests for examples on how to use the Enum Binder.

You can see the latest NuGet here: https://www.nuget.org/packages/Cake.ArgumentBinder/0.5.0