Skip to content

Latest commit

 

History

History
585 lines (433 loc) · 26.9 KB

CHANGELOG.md

File metadata and controls

585 lines (433 loc) · 26.9 KB

Changelog

Unreleased changes:

Fixes

  • @ernstc: bugfix: added check on the model type before it proceeds accessing the property (#519)

Fixes

  • @xoofx: use explicit constructors on validation attributes to workaround .NET 6 runtime trimming error (#491)
  • @jakubqwe: support the Description field of VersionOptionFromMemberAttribute (#490)

Features

  • @scott-xu and @natemcmaster: feature: add API for setting default value on options and arguments, and display them in help text (#389 and #420)
  • @natemcmaster: cleanup: make .Values read-only on CommandArgument/Option (#406)
  • @natemcmaster: Make options, arguments, and commands read-only collections on CommandLineApplication (#407)

Fixes

  • @natemcmaster: fix: pass the generic argument version in callback on .Option() and Argument() (#405)
  • @natemcmaster: add .NET Standard 2.1 and fix nullable type references (#424 and #425)
  • @natemcmaster: fix new CI to correctly publish symbols to nuget.org
  • @scott-xu: show option types in help text when OptionAttribute.Template is set (#429)
  • @skirchner989: change to not throw when a validator is not of type AttributeValidator (#431)
  • @natemcmaster: don't mask OperationCanceledException triggered by SIGINT ([#483])

Other

Improvements

  • @scott-xu: Show allowed values in help text (#369)
  • @scott-xu: Generic Hosting: add overload of RunCommandLineApplicationAsync to support configuring of CommandLineApplication (#363)
  • @danielmeza: implement API on host builder to fetch CommandLineContext from non DI contexts (#368)
  • @hellfirehd and @cbcrouse: feature: add API to allow calling UseCommandLineApplication<TApp> prior to Run*Async() (#409 and #415)

Bug fixes

  • @natemcmaster: ensure clustering options is detected correctly when subcommands added via AddSubcommand (#393)
  • @scott-xu: make UnrecognizedArgumentHandling per command scope (#371)
  • @scott-xu: show allowed values in help text correctly when multiple AllowedValuesAttribute are used (#375)
  • @scott-xu: show allowed values in help text for Nullable/ValueTuple<bool,T> option/argument (#390)
  • @scott-xu: update help text to show allowed values from AllowedValues attribute instead of Enum values (#391)

Docs

Other

Improvements

  • @AlexeyEvlampiev - implement support for GUID command line options (#333) and any other type that TypeConverter supports (#62)
  • @vpkopylov - Added support for using the 'builder API' with generic host (#351)
  • @natemcmaster - Disabled the pager for help text by default. To re-enable, set UsePagerForHelpText = true. (#346)
  • @natemcmaster - Fix PlatformNotSupportedException on Xamarin of macOS (#344)

Breaking changes

See https://natemcmaster.github.io/CommandLineUtils/v3.0/upgrade-guide.html for more details.

  • Fix #251 by @mattnischan - remove API that was marked as obsolete in 2.x releases
  • Fix #294 by @natemcmaster - change dependencies on McMaster.Extensions.Hosting.CommandLine to just use Microsoft.Extensions.Hosting.Abstractions
  • Fix #337 by @natemcmaster - removed .NET Standard 1.6 target from library
  • Refactor: obsolete throwOnUnexpectedArg in favor of UnrecognizedArgumentHandling. See natemcmaster#339 for details
  • Fix #320 - lazy load command object types to reduce unnecessary allocations
  • Fix #92 by @kbilsted - Show enum names in help text for Options and Arguments stored as enum
  • Fix #287 by @Alxandr - Add support for private base type options
  • Fix #303 by @AndreGleichner - Update generated help to display [command] first then [options]
  • Fix #307 by @daveMueller - Update help text generator to display HelpOption correctly
  • Fix #302 - fix regression introduced in 2.4.2 which caused Ctrl+C handling not to terminate the process quickly
  • 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:

  • Fix #207 by @jcaillon: Option for the case sensitivity of command names

Bugs fixed:

  • Fix #203 - fix InvalidOperationException thrown during help text generation on Mono

Dec. 31, 2018

Enhancements:

Bugs fixed:

  • Fix #195: don't use Task.Run in generic host

Bugs fixed:

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 of IValueParser (#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.

New package: McMaster.Extensions.Hosting.CommandLine

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() for CommandOption<T> and CommandArgument<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 set ClusterOptions = 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 the DOTNET_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 to DefaultHelpTextGenerator 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 and CommandLineApplication.ValueParsers.
  • Added support for Option<T> and Argument<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> to CommandOptionType.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> and ValueTuple<bool,T> to CommandOptionType.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
  • Added a new, fluent API for validation.
    • Added Option().Accepts() and Argument().Accepts()
    • Add .ExistingFile()
    • Add .ExistingFileOrDirectory()
    • Add .ExistingDirectory()
    • Add .EmailAddress()
    • Add .LegalFilePath()
    • Add .MinLength(length)
    • Add .MaxLength(length)
    • Add .RegularExpression(pattern)
    • Add .Values(string[] allowedValues)

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.
  • 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() and CommandArgument.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, and VersionOptionAttribute.
  • CommandLineApplication.Execute<TApp>() - executes an app where TApp uses attributes to define its options
  • CommandLineApplication.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