Changelog History
-
v2.0.0 Changes
January 21, 2019๐ This release brings several enhancements and features that allow for building a better and more reasonable API.
Global Options
The root
Command<TRunInfo>
now has a newGlobalOptions
property that allow you to configureOptions
that are accessible to thatCommand
and any of itsSubCommands
. This allows you to configure anOption
that should be available for theCommand
or itsSubCommands
only once. The behavior ofOptions
and generalCommand
processing has not changed, and theCommand
orSubCommand
specific options are still locally scoped to where it's declared.builder.Commands.Add(new Command<TRunInfo> { Key = "command_key", // other properties like Arguments and Options omited for brevity GlobalOptions = { // add any number of global options here }, OnMatched = runInfo => { // do something with runInfo return ProcessResult.Continue; } });
OnMatched Callback for Commands
0๏ธโฃ
Commands
,SubCommands
, and theDefaultCommand
now have a newOnMatched
property, which is of typeFunc<TRunInfo, ProcessStageResult>
. This provides a hook for you to provide a custom callback that is immediately fired when a command is matched and begins processing.๐ Refer to the
Command
configuration above this section to see how it's set.๐ OnParseErrorUseMessage
๐ In several places where the
Parser
is used, you can now provide a callback that accepts the raw program argument and returns a customized error message to include as the exception's message.The 3 types they're currently available in are
PropertyArgument
,SequenceArgument
, andOption
.HelpManager's InvokeOnBuildFail
๐ Method was previously named
DisplayOnBuildFail
. It also now requires a newbool
argument namedsuppressException
, allowing you to decide whether to suppress exceptions or not. Previously, if the help menu was set to auto invoke on build fail, the exception would be suppressed, with no option to do otherwise.๐ New ArgsNullOrEmptyReturns Hook
๐ A new method was added to the builder's
Hooks
. You can now provide aFunc<TReturn>
that will be invoked if the program arguments is either null or empty. The builder will then return whatever is returned by that custom function. -
v1.0.1 Changes
- โ Add parser support for nullable enum types
-
v1.0.0 Changes
October 25, 2018๐ Initial release of the library.
Core features included:
- ๐ program arguments parsing
- ๐ parser
- help menu
- ๐ version