- .NET 6 support (including
DateOnly
andTimeOnly
). - Added
InteractiveModeOptions.Prompt
,InteractiveModeOptions.SetDefaultPrompt()
andInteractiveModeOptions.SetPrompt()
for specifying custom prompt template.PromptForeground
andScopeForeground
can still be used to configure foreground without changing prompt template. - Added support for custom binding converters
BindingConverter<T>
- seeArgumentBindingConverterTests
for examples. - Added
BindableArgument
andBindableArgument.Bindable
, as well as markedArgumentSchema.Property
,ArgumentSchema.IsScalar
, andArgumentSchema.GetValidValues()
obsolete - will be removed in Typin 4.0. BindableArgument.IsScalar
andBindableArgument.GetValidValues()
are now optimized with a simple cache (backing field).- Faster
Guid
binding by explicitGuid.Parse()
call (addedGuid
toArgumentBinder.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-beta1
were 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
IDisposable
anti-pattern inIConsole
-IDisposable
is no longer present inIConsole
. If you wish to use it, implement it inIConsole
implementation. - Removed
IDisposable
fromCliContext
.
- 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 [!]\r
was executing default command. - Fixed
DefaultDirective
behavior (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.Core
library. - Core middleware execution order has changed:
ResolveCommandSchemaAndInstance
->InitializeDirectives
->ExecuteDirectivesSubpipeline
-> [Directives subpipeline] ->HandleSpecialOptions
->BindInput
-> [User middlewares] ->ExecuteCommand
. - Renamed
normal mode
todirect 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
HandleInteractiveDirective
andHandleInteractiveCommands
middlewares. - Replaced
IsInteractiveModeOnly
withSupportedModes
andExcludedModes
. - Added support for options with no name by automatic conversion of property names.
- Added native support for .NET 5.0 (including usage of
init
instead ofget
). - Added
Typin.Console.IO
namespace withIStandardInput
,IStandardOuput
,IStandardError
,IStandardOutputAndError
,IStandardRedirectableConsoleStream
,StandardStreamReader
,StandardStreamWriter
. - Rewritten
Typin.Core.Console.ConsoleExtensions
to targetStandardStreamWriter
. - User middlewares are now executed after command instance creation.
- Middleware types collection in
ApplicationConfiguration
order was reversed. - Merged
HandleVersionOption
andHandleHelpOption
into one middleware namedHandleSpecialOptions
. - Removed unnecessary casts to
CliContext
fromICliContext
. - Removed
IDirective.ContinueExecution
, modifiedIDirective
, and addedIPipelinedDirective
. CommandPipelineHandlerDelegate
now usesValueTask
instead 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.,
--h
is 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.RunAsync
with string command line and replacedIReadOnlyList<string>
withIEnumerable<string>
. - Advanced interactive input is disabled when input is redirected.
- Added
IRootSchemaAccessor
andIEnvironmentVariablesAccessor
singleton services; - Added
ExceptionFormatter
utility and used it as a default exception printer inDefaultExceptionHandler
. TableUtils
refactory 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.IsOptionAlias
bug. - It is no possible to scope to
cmd
command even if there is onlycmd sub
in 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.UseServiceProviderFactory
andCliApplicationBuilder.ConfigureContainer
). - Added
ShortcutDefinition
struct 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
,--version
will still work without[!]
directive.- Improvements in
Ctrl+[Delete/Backspace/ArrowLeft/ArrowRight]
handling. - Renamed
EnvironmentVariableName
toFallbackVariableName
. - Added
IOptionFallbackProvider
, as well asEnvironmentVariableFallbackProvider
as default implementation ofIOptionFallbackProvider
andEmptyFallbackProvider
that can be used to disable fallback. - Command execution now heavily uses middleware pipeline (
ResolveCommandSchema
->HandleVersionOption
->ResolveCommandInstance
->HandleInteractiveDirective
->HandleHelpOption
->HandleInteractiveCommands
->ExecuteCommand
). - Added
CliExecutionScope
and ensured thatContext.Input
,Context.Command
,Context.CommandDefaultValues
,Context.CommandSchema
, andContext.ExitCode
are reset to default values after middleware pipeline execution. - Added
IHelpWriter
, renamedHelpTextWriter
toDefaultHelpWriter
, and madeDefaultHelpWriter
a public class. - Fixed
AddDirectivesFrom(Assembly directiveAssembly)
andAddDirectivesFrom(IEnumerable<Assembly> directiveAssemblies)
. - Removed partial classes.
- Removed middleware delegate parameters.
- Added interactive mode
CliInteractiveApplication
and interactive only commands. - Added
ICliExceptionHandler
andCliApplicationBuilder.UseExceptionHandler(...)
- Added
Manual
property inCommandAttribute
that can be used to provide a long, extended description of a commmand. - Added
CliContext
that can be injected to services and commands with DI. - Added
ReadKey
,SetCursorPosition
,WindowWidth
,WindowHeight
,BufferWidth
, andBufferHeight
toIConsole
. - 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
RootSchema
with 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.UseTypeActivator
and addedMicrosoft.Extensions.DependencyInjection
- Added support for middlewares.
- Added
TableUtils
andTextUtils
. - Added history and auto-completion in interactive mode.
- Indirect fork from CliFx.