From 90a01e729b63c055a7bdb3441b52de8e2f60a401 Mon Sep 17 00:00:00 2001 From: Tyrrrz Date: Sun, 6 Dec 2020 18:42:58 +0200 Subject: [PATCH] Update version --- Changelog.md | 6 ++++++ CliFx.props | 2 +- Readme.md | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 39d72c2..0694779 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +### v1.6 (06-Dec-2020) + +- Added support for custom value validators. You can now create a type that inherits from `CliFx.ArgumentValueValidator` to implement reusable validation logic for command arguments. To use a validator, include it in the `Validators` property on the `CommandOption` or `CommandParameter` attribute. (Thanks [@Oleksandr Shustov](https://github.com/AlexandrShustov)) +- Added `CliFx.ArgumentValueConverter` class that you can inherit from to implement custom value converters. `CliFx.IArgumentValueConverter` interface is still available, but it is recommended to inherit from the generic class instead, due to the type safety it provides. The interface may become internal or get removed in one of the future major versions. +- Updated requirements for option names and short names: short names now must be letter characters (lowercase or uppercase), while names must now start with a letter character. This means option names can no longer start with a digit or a special character. This change makes it possible to pass negative number values without the need to quote them, i.e. `--my-number -5`. + ### v1.5 (23-Oct-2020) - Added pretty-printing for unhandled exceptions thrown from within the application. This makes the errors easier to parse visually and should help in troubleshooting. This change does not affect `CommandException`, as it already has special treatment. (Thanks [@Mårten Åsberg](https://github.com/89netraM)) diff --git a/CliFx.props b/CliFx.props index 017e2b6..d8e5683 100644 --- a/CliFx.props +++ b/CliFx.props @@ -1,7 +1,7 @@ - 1.5 + 1.6 Tyrrrz Copyright (C) Alexey Golub latest diff --git a/Readme.md b/Readme.md index bfd80f2..0e594de 100644 --- a/Readme.md +++ b/Readme.md @@ -264,9 +264,9 @@ When defining a parameter of an enumerable type, keep in mind that it has to be ```c# // Maps 2D vectors from AxB notation -public class VectorConverter : IArgumentValueConverter +public class VectorConverter : ArgumentValueConverter { - public object ConvertFrom(string value) + public override Vector2 ConvertFrom(string value) { var components = value.Split('x', 'X', ';'); var x = int.Parse(components[0], CultureInfo.InvariantCulture);