- [#92] by [@kbilsted] - Show enum names in help text for Options and Arguments stored as enum
- [#288] by @Alxandr - Add support for private base type options
- Fix #286 - fix deadlock in CTRL+C handling on Windows
- Fix #277 - workaround a bug in NuGet's 'deterministic packaging' feature which causes issues based on your timezone
- Fix #227 by @ejball - ArgumentEscaper should escape empty string
- PR #230 by @IanG - Attributes for files and directories that must not exist
- Fix #221 by @vpkopylov - Use Pager for help text option only works on top-level help
- PR #239 by @vpkopylov - Add check for subcommand cycle
- Support C# 8.0 and nullable reference types - #245
- Add async methods to CommandLineApplication
- Fix #208 - make
CommandLineApplication.ExecuteAsync
actually asynchronous - Fix #153 - add async methods that accept cancellation tokens
- Fix #111 - Handle CTRL+C by default
- Fix #246 by @kyle-rader - Multi-line option descriptions do not indent correctly
- Fix #253 - support calling CommandLineApplication.Execute multiple times
Bugs fixed:
- Fix #218: Handle options with multiple characters in the short option name when only specified in a subcommand
- PR #224 by @SteveBenz: Rearrange the order that commands are listed in the USAGE block and list all the commands on the line
Enhancements:
- @mpipo: add an API to disable the pager for help text (CommandLineApplication.UsePagerForHelpText) (#216)
Enhancements:
- Fix #211 by @rlvandaveer: honor attributes on classes which implement ValidationAttribute
Bugs fixed:
Bugs fixed:
- Fix #203 - fix InvalidOperationException thrown during help text generation on Mono
Dec. 31, 2018
Enhancements:
- PR #192 by @TheConstructor: Add IUnhandledExceptionHandler
Bugs fixed:
- Fix #195: don't use Task.Run in generic host
Bugs fixed:
- Fix #189 by @TheConstructor: fix inference about clustering options for sub-sub-commands
Enhancements:
- Fix #166 by @TheConstructor: make CommandLineApplication.GetValidationResult() public
- PR #192 by @TheConstructor: improve error handling in generic host, and unwrap TargetInvocationException
Bugs fixed:
- Fix #86 by @handcraftedsource: handled nested HelpOptions. Fixes InvalidOperationException when multiple help options were defined.(#158)
- Fix #163 - Obsolete CommandOption.Template and fix help text generation to accurately list available options
- @TheConstructor: fixed a bug in ConstructorInjectionConvention (#181)
Enhancements:
- @jcaillon: Add a new API
UnrecognizedCommandParsingException
which includes suggestions for similar options or commands. (#164) - Add support counting of bool/flag variables using
bool[]
. (#143) - @EricStG: Add a new API
MissingParameterlessConstructorException
that includes the type causing the exception in the message. ([#148]) - @atifaziz: Add a new API
ValueParser.Create
which makes it easier to create implementations ofIValueParser
(#169) - @TheConstructor: Support injection of IConsole and IConvention in generic host (#178)
Other notes:
- I adjusted some API released in the alpha - primarily, I removed ParserSettings.
Thanks to @lucastheisen for writing a new package, McMaster.Extensions.Hosting.CommandLine (#167). This new package provides integration with ASP.NET Core's "Generic Host" feature..
Enhancements:
-
Support the POSIX convention for cluster multiple options. For example,
-ixd
is treated the same as-i -x -d
. Resolved #93. -
@bjorg: support SingleOrNoValue notation.
--option[:value]
-
New type:
Pager
. Provides a simple interaction model for displaying console output in a pager. -
Display help text using the
less
pager on macOS/Linux. -
Make suggestions when invalid options or commands are used, but there is a valid one that is similar. (Thanks to @MadbHatter for doing the initial work on this.)
-
Add support for subcommand aliases. Commands can be given multiple names.
[Command("organization", "org", "o")] public class OrgCommand { }
-
Obsolete the constructor of
[Subcommand]
which takes a string. -
Infer subcommand names from the type name
[Subcommand(typeof(AddCommand))] public class Git { } public class AddCommand { } // subcommand name = "add"
-
@lvermeulen: Sort subcommands by name in help text. This can be disabled with
DefaultHelpTextGenerator.SortCommandsByName
.
Bugs fixed:
- Duplicate subcommand names used to cause undefined behavior. Now, attempting to add a duplicate subcommand name or aliases will cause the library to throw before the app can execute.
- Fix bug in subcommand name inference. When not specified, the subcommand always matched the entry assembly name. In this update, this convention only applies to the parent command.
- Fix #131 - Add generic overloads of
.IsRequired()
forCommandOption<T>
andCommandArgument<T>
.
Details:
-
Clustering options: I've added this behavior as the new default, but only if I think it won't interfere with existing apps. If it causes issues or you don't like clustering, you can disable this by setting
CommandLineApplication.ClusterOptions = false
. To preserve compatibility with existing apps, this behavior is off if you have configured options with short names with multiple characters. In a future version, this will cause an error unless you setClusterOptions = false
. -
Pager: this is the new default for showing help text. The pager should have graceful fallback to regular stdout when there are issues launching
less
, or when stdout is redirected into a pipe.
July 1, 2018
Bug fixes:
- @bording and @SeanFeldman: Unable to create new instance of
CommandOption<T>
for type that is already registered
Minor improvements:
- Started code signing the NuGet package and binaries
- @jerriep: added documentation for response file parsing
May 24, 2018
Bug fixes:
- @liamdawson: support parsing
System.Uri
- Fix #101 - Update
DotNetExe.FullPath
to honor theDOTNET_ROOT
environment variable as a fallback
May 10, 2018
Minor improvements:
- Make it easier to override the version text shown when
--version
is specified. - Make DefaultHelpTextGenerator's constructor protected
- Fix DebugHelper.HandleDebugSwitch
April 28, 2018
Minor improvement:
- Add conventions from attributes that implement IConvention and IMemberConvention
- Add a help option by default as long as it doesn't conflict with existing options
April 10, 2018
Bug fixes:
- Don't assign option and argument options if no value was provided, preserving the default CLR value unless there is user-input.
- Fix ShowHint() to use ShortName or SymbolName if OptionHelp.LongName is not set
- Fix #85 - lower priority of resolving AdditionalServices after most built-in services
- Fix #79 - OnValidate callbacks invoked before property values were assigned
Minor improvements:
- Improve help text generation. Align columns, show top-level command description, and add
protected virtual
API toDefaultHelpTextGenerator
to make it easier to customize help text
March 30, 2018
- Added support for command validators using
CommandLineApplication.Validators
and added a new OnValidate convention - Fix minor bug in
ArgumentEscaper
where some strings were not properly escaped - Update to System.ComponentModel.Annotations 4.4.1 (netstandard2.0 only)
- @atruskie: Ensure ValueParsers are inherited in subcommands
March 23, 2018
New API:
- @atruskie: Added support for user-defined value parsers using
IValueParser
andCommandLineApplication.ValueParsers
. - Added support for
Option<T>
andArgument<T>
- Added
IValidationBuilder<T>
- Added
.Accepts().Range(min, max)
for int and double type arguments and options
Enhancements:
- Parse these values to boolean: T, t, F, f, 0, 1
Removed:
- Removed support for mapping
Tuple<bool,T>
toCommandOptionType.SingleOrNoValue
.ValueTuple<bool,T>
is still present.
March 7, 2018
New features:
- Add
CommandOptionType.SingleOrNoValue
. Options of this type can be a switch, or have a value but only in the form--param:value
or--param=value
. - Support mapping
Tuple<bool,T>
andValueTuple<bool,T>
toCommandOptionType.SingleOrNoValue
- Added
CommandLineApplication<TModel>
. This allows associating an application with a specific .NET type - Convention API. Adds support for writing your own conventions to convert command line arguments into a .NET type
- @sebastienros - Support for case-insensitive options
- Add support for constructor injection and dependency injection by providing a custom service provider
Feb. 15, 2018
New features:
- Added more validation attributes.
- Add the
[FileExists]
attribute - Add the
[FileOrDirectoryExists]
attribute - Add the
[DirectoryExists]
attribute - Add the
[LegalFilePath]
attribute - Add the
[AllowedValues]
attribute
- Add the
- Added a new, fluent API for validation.
- Added
Option().Accepts()
andArgument().Accepts()
- Add
.ExistingFile()
- Add
.ExistingFileOrDirectory()
- Add
.ExistingDirectory()
- Add
.EmailAddress()
- Add
.LegalFilePath()
- Add
.MinLength(length)
- Add
.MaxLength(length)
- Add
.RegularExpression(pattern)
- Add
.Values(string[] allowedValues)
- Added
API improvements:
- Support parsing enums
- @atruskie - Support for parsing double and floats
- @rmcc13 -
HelpOption
can be set to be inherited by all subcommands - Add
VersionOptionFromMember
to use a property or method as the source of version information
Dec. 27, 2017
Bug fixes:
- Do not show validation error messages when --help or --version are specified
- Fix help text to show correct short option when
OptionAttribute.ShortName
is overriden
Dec. 12, 2017
New features:
- Attributes. Simplify command line argument definitions by adding attributes to a class that represents options and arguments.
- Options defined as
[Option]
or[Argument]
,[Subcommand]
. - Command parsing options can be defined with
[Command]
and[Subcmomand]
. - Special options include
[HelpOption]
and[VersionOption]
. - Validation. You can use
[Required]
and any other ValidationAttribute to validate input on options and arguments.
- Options defined as
- Async from end to end. Using C# 7.1 and attribute binding, your console app can be async from top to bottom.
- Required options and arguments. Added
CommandOption.IsRequired()
andCommandArgument.IsRequired()
.
New API
- @demosdemon - added
Prompt.GetSecureString
Prompt.GetYesNo
,Prompt.GetPassword
, and more. Added API for interactively getting responses on the console.- Added
OptionAttribute
,ArgumentAttribute
,CommandAttribute
,SubcommandAttribute
,HelpOptionAttribute
, andVersionOptionAttribute
. CommandLineApplication.Execute<TApp>()
- executes an app whereTApp
uses attributes to define its optionsCommandLineApplication.ExecuteAsync<TApp>()
- sample thing, but async.CommandLineApplication.ResponseFileHandling
- the parser can treat arguments that begin with '@' as response files. Response files contain arguments that will be treated as if they were passed on command line.- @couven92 - added overloads for few new
CommandLineApplication.VersionOptionFromAssemblyAttributes
and.VerboseOption
extension methods
Minor bug fixes:
- Add return types to
.VerboseOption()
and ensure.HasValue()
is true when HelpOption or VerboseOption are matched - Fix a NullReferenceException in some edge cases when parsing args
- Fix bug where
DotNetExe.FullPath
might return the wrong location of the dotnet.exe file
Other:
- @kant2002 - added a new sample to demonstrate async usage
Oct. 31, 2017
- @couven92 - Add support for .NET Standard 1.6
Sep. 16, 2017
- Initial version of this library.
- Forked Microsoft.Extensions.CommandLineUtils
- Renamed root namespace to McMaster.Extensions.CommandLineUtils
- Added a handful of new API
- Updated TFM to support .NET Standard 2.0