diff --git a/Changelog.md b/Changelog.md index 133913f..f5b59bb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,14 @@ +### v1.2 (11-May-2020) + +- Added built-in Roslyn analyzers that help catch incorrect usage of the library. Currently, all analyzers report issues as warnings so as to not prevent the project from building. In the future that may change. +- Added an optional parameter to `new CommandException(...)` called `showHelp` which can be used to instruct CliFx to show help for the current command after printing the error. (Thanks [@Domn Werner](https://github.com/domn1995)) +- Improved help text shown for enum options and parameters by providing the list of valid values that the enum can accept. (Thanks [@Domn Werner](https://github.com/domn1995)) +- Fixed an issue where it was possible to set an option without providing a value, while the option was marked as required. +- Fixed an issue where it was possible to configure an option with an empty name or a name consisting of a single character. If you want to use a single character as a name, you should set the option's short name instead. +- Added `CursorLeft` and `CursorTop` properties to `IConsole` and its implementations. In `VirtualConsole`, these are just auto-properties. +- Improved exception messages. +- Improved exceptions related to user input by also showing help text after the error message. (Thanks [@Domn Werner](https://github.com/domn1995)) + ### v1.1 (16-Mar-2020) - Changed `IConsole` interface (and as a result, `SystemConsole` and `VirtualConsole`) to support writing binary data. Instead of `TextReader`/`TextWriter` instances, the streams are now exposed as `StreamReader`/`StreamWriter` which provide the `BaseStream` property that allows raw access. Existing usages inside commands should remain the same because `StreamReader`/`StreamWriter` are compatible with their base classes `TextReader`/`TextWriter`, but if you were using `VirtualConsole` in tests, you may have to update it to the new API. Refer to the readme for more info. diff --git a/CliFx.props b/CliFx.props index 4d559d1..ac93229 100644 --- a/CliFx.props +++ b/CliFx.props @@ -1,7 +1,7 @@ - 1.1 + 1.2 Tyrrrz Copyright (C) Alexey Golub latest diff --git a/Readme.md b/Readme.md index ec94a65..40a0aa4 100644 --- a/Readme.md +++ b/Readme.md @@ -431,7 +431,7 @@ Division by zero is not supported. 1337 ``` -You can use the `showHelp` parameter to choose whether to show the help text after handling an exception. For example, you can tell CliFx to show `ExampleCommand`'s help text upon an error like this: +You can also specify the `showHelp` parameter to instruct whether to show the help text after printing the error: ```c# [Command] @@ -439,20 +439,7 @@ public class ExampleCommand : ICommand { public ValueTask ExecuteAsync(IConsole console) { - throw new CommandException(showHelp: true); - } -} -``` - -To display an error message before the help text, throw the `CommandException` like this: - -```c# -[Command] -public class ExampleCommand : ICommand -{ - public ValueTask ExecuteAsync(IConsole console) - { - throw new CommandException("My custom error message.", showHelp: true); + throw new CommandException("Something went wrong.", showHelp: true); } } ```