- .NET 6 support (including
DateOnlyandTimeOnly). - Added
InteractiveModeOptions.Prompt,InteractiveModeOptions.SetDefaultPrompt()andInteractiveModeOptions.SetPrompt()for specifying custom prompt template.PromptForegroundandScopeForegroundcan still be used to configure foreground without changing prompt template. - Added support for custom binding converters
BindingConverter<T>- seeArgumentBindingConverterTestsfor examples. - Added
BindableArgumentandBindableArgument.Bindable, as well as markedArgumentSchema.Property,ArgumentSchema.IsScalar, andArgumentSchema.GetValidValues()obsolete - will be removed in Typin 4.0. BindableArgument.IsScalarandBindableArgument.GetValidValues()are now optimized with a simple cache (backing field).- Faster
Guidbinding by explicitGuid.Parse()call (addedGuidtoArgumentBinder.PrimitiveConverters). - Changed default values format in help - now in round brackets.
- Fixed
StackTraceParser: add a filter for--- End of stack trace from previous location ---and--- End of stack trace from previous location where exception was thrown ---. - Fixed invalid help text:
Environment variable:instead ofFallback variable:. - Fixed default version format (complex versions like
3.0.0-beta1were incorrectly dispalyed as3.0.0). - Fixed console not being disposed when stopping the application (for consoles that were created within
CliApplicationBuilder). - Fixed showing choices for non-scalar nullable and non-nullable enum arguments.
- Fixed dependency injection
IDisposableanti-pattern inIConsole-IDisposableis no longer present inIConsole. If you wish to use it, implement it inIConsoleimplementation. - Removed
IDisposablefromCliContext.
- Fixed issue #208: interactive mode executes the command line arguments at every new commands.
- Fixed
DefaultDirective([!]) executes default command - unable to execute scoped command without parameters, e.g.,[>] books\r [!]\rwas executing default command. - Fixed
DefaultDirectivebehavior (more consistent with direct mode): it WILL NOT (was: WILL) force default command execution when input contains default commmand parameter values equal to command/subcommand name.
- Fixed
CliApplicationBuilder.UseHelpWriter<>- it was usingUseOptionFallbackProvider(Type)instead ofUseHelpWriter(Type).
- Fixed Ctrl+C in interactive mode.
- .NET 5/C# 9 related refactor.
- Added
Typin.Corelibrary. - Core middleware execution order has changed:
ResolveCommandSchemaAndInstance->InitializeDirectives->ExecuteDirectivesSubpipeline-> [Directives subpipeline] ->HandleSpecialOptions->BindInput-> [User middlewares] ->ExecuteCommand. - Renamed
normal modetodirect mode, and added support for custom modes. - It is now possible to register multiple exception handleres to handle different exceptions in app.
- Major API and command execution changes: a) added
ICliApplicationLifetime,ICliMode,ICliCommandExecutor,ICliApplicationLifetime,DirectMode,InteractiveMode,IPipelinedDirective, and more; b) removedInteractiveCliApplication. - Removed
HandleInteractiveDirectiveandHandleInteractiveCommandsmiddlewares. - Replaced
IsInteractiveModeOnlywithSupportedModesandExcludedModes. - Added support for options with no name by automatic conversion of property names.
- Added native support for .NET 5.0 (including usage of
initinstead ofget). - Added
Typin.Console.IOnamespace withIStandardInput,IStandardOuput,IStandardError,IStandardOutputAndError,IStandardRedirectableConsoleStream,StandardStreamReader,StandardStreamWriter. - Rewritten
Typin.Core.Console.ConsoleExtensionsto targetStandardStreamWriter. - User middlewares are now executed after command instance creation.
- Middleware types collection in
ApplicationConfigurationorder was reversed. - Merged
HandleVersionOptionandHandleHelpOptioninto one middleware namedHandleSpecialOptions. - Removed unnecessary casts to
CliContextfromICliContext. - Removed
IDirective.ContinueExecution, modifiedIDirective, and addedIPipelinedDirective. CommandPipelineHandlerDelegatenow usesValueTaskinstead of aTask.- Added logging with
Microsoft.Extensions.Logging(default logger isDebugLogger). - Added
IConsole.ReadKeyAsync(). - Option name with 3 characters is no longer treated as option alias (e.g.,
--his not-h). - Option name and short name must start with letter (previously not start with digit).
- Parameter names are generated using
StringExtensions.ToHyphenCase()instead ofstring.ToLowerInvariant(). - Option attributes are validated in ctor, and appropiate exception is thrown without the need of resolving RootSchema.
- Added
TextUtils.UnescapeChar()and a support for the following escape sequences: '\0', '\a', '\b', '\f', '\n', '\r', '\t', '\v', '\\', and Unicode escape e.g. \u006A) during char parsing. - Added
CliApplication.RunAsyncwith string command line and replacedIReadOnlyList<string>withIEnumerable<string>. - Advanced interactive input is disabled when input is redirected.
- Added
IRootSchemaAccessorandIEnvironmentVariablesAccessorsingleton services; - Added
ExceptionFormatterutility and used it as a default exception printer inDefaultExceptionHandler. TableUtilsrefactory and fix for proper handling of empty collection.[!]directive is now required only to execute command without parameters and options.- Added startup message color personalization, and replaced string formating based on macros with
Func<ApplicationMetadata, string>andAction<ApplicationMetadata, IConsole>. - Fixed case-sensitivity of command and option names (always case-sesitive).
- Fixed interactive mode autocompletion results (fo 'column chan' TAB TAB result was 'column column change-range' instead of 'column change-range').
- Fixed
CommandOptionInput.IsOptionAliasbug. - It is no possible to scope to
cmdcommand even if there is onlycmd subin application. - Added
CommandInput.Arguments. - Added
RootSchema.IsCommandOrSubcommandPart(). [>]is now not resseting the scope when no name after[>].
- Schemas resolving improvements
- Added support for strings with spaces by surrounding with
"in interactive mode (to escape"type"") with a custom command line splitter that works in both interactive and direct modes. - Fixed negative numbers handling by forbidding options starting from digit. Options must have a name starting from char other than digit, while short name must not be a digit.
- Auto-completion bug fixes.
- Added preview of custom DI containter support (
CliApplicationBuilder.UseServiceProviderFactoryandCliApplicationBuilder.ConfigureContainer). - Added
ShortcutDefinitionstruct and user defined shortcuts configuration inCliApplicationBuilder.UseInteractiveMode(...). - Improvements in shortcuts handling.
- Renamed
[default]directive to[!]. [!]directive is now required to execute user-defined default command. However,-h,--help,--versionwill still work without[!]directive.- Improvements in
Ctrl+[Delete/Backspace/ArrowLeft/ArrowRight]handling. - Renamed
EnvironmentVariableNametoFallbackVariableName. - Added
IOptionFallbackProvider, as well asEnvironmentVariableFallbackProvideras default implementation ofIOptionFallbackProviderandEmptyFallbackProviderthat can be used to disable fallback. - Command execution now heavily uses middleware pipeline (
ResolveCommandSchema->HandleVersionOption->ResolveCommandInstance->HandleInteractiveDirective->HandleHelpOption->HandleInteractiveCommands->ExecuteCommand). - Added
CliExecutionScopeand ensured thatContext.Input,Context.Command,Context.CommandDefaultValues,Context.CommandSchema, andContext.ExitCodeare reset to default values after middleware pipeline execution. - Added
IHelpWriter, renamedHelpTextWritertoDefaultHelpWriter, and madeDefaultHelpWritera public class. - Fixed
AddDirectivesFrom(Assembly directiveAssembly)andAddDirectivesFrom(IEnumerable<Assembly> directiveAssemblies). - Removed partial classes.
- Removed middleware delegate parameters.
- Added interactive mode
CliInteractiveApplicationand interactive only commands. - Added
ICliExceptionHandlerandCliApplicationBuilder.UseExceptionHandler(...) - Added
Manualproperty inCommandAttributethat can be used to provide a long, extended description of a commmand. - Added
CliContextthat can be injected to services and commands with DI. - Added
ReadKey,SetCursorPosition,WindowWidth,WindowHeight,BufferWidth, andBufferHeighttoIConsole. - Added new demo apps and improved existing demo.
- Added
Debugger attached to PID {processId}.message after debugger attachment. - Added benchmarks for multiple commands.
- Added startup message option with macros.
- Rewritten
RootSchemawith HashSet for faster execution, esspecially in interactive mode. - Added tests of the command used in benchmarking to easily check if it executs correctly and won't cause banchmarking freezing.
- Improved code readability.
- Removed
CliApplicationBuilder.UseTypeActivatorand addedMicrosoft.Extensions.DependencyInjection - Added support for middlewares.
- Added
TableUtilsandTextUtils. - Added history and auto-completion in interactive mode.
- Indirect fork from CliFx.