Version 4
bilal-fazlani
released this
13 May 09:13
·
434 commits
to master
since this release
Nullable Reference Types
The library has been updated to support Nullable Reference Types
Default behavior changes
Version 4 is removing obsolete members and changing default behaviors made possible since the v3 was introduced.
- default
AppSettings.Help.ExpandArgumentsInUsage
to true.- arguments are expanded in the usage section of help.
- old:
add [options] [arguments]
- new:
add [options] <x> <y>
- old:
- arguments are expanded in the usage section of help.
- default
AppSettings.DefaultArgumentSeparatorStrategy
toEndOfOptions
. See Argument Separator for details.- Help will append
[[--] <arg>...]
to the usage example whenDefaultArgumentSeparatorStrategy=PassThru
- Help will append
- make
AppSettings.LongNameAlwaysDefaultsToSymbolName
the only behavior and remove the setting.LongName
can be removed with[Option(LongName=null)]
.- Look for places in your apps where
[Option(ShortName="a")]
with setting a LongName. If you don't want a LongName then addLongName=null
otherwise the long name will default from the parameter or property name.
- Look for places in your apps where
- make
AppSettings.GuaranteeOperandOrderInArgumentModels
the only behavior and remove the setting.- see this Argument Models section for details
- enable CommandLogger in
.UseDefaultMiddleware()
ascmdlog
directive. This can be useful for diagnostics. - Command.FindOption will throw an exception if the alias is for an operand or subcommand instead of an option. Previously it would return null.
Added
- The type
MiddlewareSteps
declares most of the framework defined middleware to make it easier to inject your custom middleware in the desired order.
Changed
- When registering middleware, the OrderInStage parameter has been changed from
int
toshort
.
Moved
CommandDotNet.Directives.Parse.ParseReporter
- moved toCommandDotNet.Diagnostics.Parse.ParseReporter
CommandDotNet.Directives.Debugger
- moved toCommandDotNet.Diagnostics.Debugger
AppConfig.CancellationToken
- moved toCommandDotNet.CancellationToken
. This enables running nested commands within an interactive session. See Ctrl+C and CancellationToken for more details.
Removed or Replaced
AppSettings
MethodArgumentMode
- replaced byDefaultArgumentMode
ThrowOnUnexpectedArgument
- replaced byIgnoreUnexpectedArguments
AllowArgumentSeparator
- was never used for functionality, only to show--
in help.HelpTextStyle
- replaced byHelp.TextStyle
Help
GlobalTool
- replaced byUsageAppName
VersionInfo
- replaced byAppInfo
ApplicationMetadataAttribute
- replaced byCommandAttribute
ArgumentAttribute
- replaced byOperandAttribute
ArgumentMode.Parameter
- replaced byOperand
InjectPropertyAttribute
- v3 made ctor injection possible and that should be used.Command
,Option
,Operand
ctor taking withCommand parent
parameter.Parent
is now assigned by adding to a command.OptionAttribute
Inherited
- replaced byAssignToExecutableSubcommands
Option
DefaultValue
- useOption.Default
Inherited
- replaced byAssignToExecutableSubcommands
Operand
DefaultValue
- useOption.Default
IArgument
DefaultValue
- useOption.Default
appRunner.UseDefaultsFromConfig
extension method that returns string, in favor of method with same name returningArgumentDefault
TokenCollection
public ctor - UseTokenizer.Tokenize
extension method to generate tokens andTokenCollection.Transform
to transform them. Ensures source tokens are correctly mapped.AnsiConsole
- no longer supported. Use a package like ColorConsole or Pastel.MiddlewareSteps.Help.Stage
&MiddlewareSteps.Help.Order
- replaced by nestedMiddlewareSteps.Help
classesServicesExtensions.GetOrAdd<T>
- useContextDataExtensions.GetOrAdd<T>