CommandDotNet_5.0.1 #386
drewburlingame
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
#318 (comment)
CommandDotNet
5.0.1
remove nuget package refs no longer required after move to net5.0
5.0.0
Highlights
NRT
CommandDotNet now supports Nullable reference types (NRT) when calculating Arity. Arityfor.Minimum will be 0 for NRTs.
target net5.0
CommandDotNet targets net5.0 instead of netstandard2.0. This will allow us to take advantage of new framework features.
We're holding off on net6.0 at the moment because it's new enough many companies will not be able to adopt it yet.
We are eager to take advantage of Source Generators though so we will likely also target net6.0 in early 2022.
Windows and Powershell conventions
Added support for Windows and Powershell conventions when using options
/help
and/h
for windows conventions-help
for long names for powershell conventionsThese are not enabled by default. Enable by setting
AppSettings.Parser.AllowBackslashOptionPrefix
and/orAppSettings.Parser.AllowSingleHyphenForLongNames
=true
.Support negative numbers as arguments
Previously, negative numbers were only support when proceeded by
:
or=
, eg--amount=-15
which meant they could only be used with options. CommandDotNet now supports--amount -15
or-15
as an operand.IConsole
Overhaul of IConsole, now covering most the System.Console members. Converted In, Out and Error to TextReader and TextWriter to match System.Console.
This includes updates to the TestConsole and AnsiTestConsole for the Spectre integration.
Overhaul of IConsole, now covering most the System.Console members. Converted In, Out and Error to TextReader and TextWriter to match System.Console.
This includes updates to the TestConsole and AnsiTestConsole for the Spectre integration.
Breaking Changes in behavior
NRT support
The behavior for calculating Arity and prompting on missing arguments changes as these arguments were not previously considered nullable and so the Arity has changed to expect a minimum of 0 instead of 1
Using the UseArgumentPrompter will now work as expected when using NRTs. They will no longer prompt the user.
ArgumentArity.AllowsNone() change
This has been a confusing method. It currently evaluates as
arity.Maximum == 0
but it intuitively it makes more sense asarity.Minimum == 0
.ArgumentArity.AllowsNone() has been changed to
arity.Minimum == 0
ArgumentArity.RequiresNone() has been added for
arity.Maximum == 0
.Breaking Changes in API
For application developers
Obsoleted cleanup
DefaultMethodAttribute
. UseDefaultCommandAttribute
instead.appRunner.UsePrompting(...)
extension method. Use.UseIPrompter
and.UseArgumentPrompter
instead.BooleanMode.Unknown
. Use eitherImplicit
,Explicit
, orBooleanMode?
instead.Localizable Resources
Several updates to localizeable Resources. Changed a few member names for clarity and anded a several new members.
AppSettings
For middleware developers
IArgument updates
IConsole updates
DefaultSources.AppSetting.GetKeysFromConvention
Now takes AppSettings to support
/
and-
option prefixes.TokenType.Option removed
To support negative numbers and prefixing options with
/
and-
, we needed more context from the command definition so determining if a token is an option or value has been moved to the command parser. Token transformation no longer distinguishes options vs values.IInvocation updates
added IsInterceptor property to distinguish between command and interceptor invocations
Obsoleted cleanup
ArgumentArity.Default(Type, ...)
. UseArgumentArity.Default(IArgument)
instead. This is a reversal of previous direction, but the addition of IArgument.BooleanMode makes this reliable.FindOption(string alias)
. UseFind<Option>(string alias)
instead.command.GetIgnoreUnexpectedOperands(AppSettings)
. Usecommand.IgnoreUnexpectedOperands
as it now defaults from AppSettings.command.GetArgumentSeparatorStrategy(AppSettings)
. Usecommand.ArgumentSeparatorStrategy
as it now defaults from AppSettings.Option.ShowInHelp
. UseOption.Hidden
instead. There were cases where this had meaning outside of generating help.This discussion was created from the release CommandDotNet_5.0.1.
Beta Was this translation helpful? Give feedback.
All reactions