Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass the generic argument version in callback on .Option() and .Argument() #405

Merged
merged 1 commit into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/CommandLineUtils/CommandLineApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public CommandOption Option(string template, string description, CommandOptionTy
/// <param name="inherited"></param>
/// <typeparam name="T">The type of the values on the option</typeparam>
/// <returns>The option</returns>
public CommandOption<T> Option<T>(string template, string description, CommandOptionType optionType, Action<CommandOption> configuration, bool inherited)
public CommandOption<T> Option<T>(string template, string description, CommandOptionType optionType, Action<CommandOption<T>> configuration, bool inherited)
{
var parser = ValueParsers.GetParser<T>();

Expand Down Expand Up @@ -642,7 +642,7 @@ public CommandArgument Argument(string name, string description, Action<CommandA
/// <param name="multipleValues"></param>
/// <typeparam name="T">The type of the values on the option</typeparam>
/// <returns></returns>
public CommandArgument<T> Argument<T>(string name, string description, Action<CommandArgument> configuration, bool multipleValues = false)
public CommandArgument<T> Argument<T>(string name, string description, Action<CommandArgument<T>> configuration, bool multipleValues = false)
#pragma warning restore RS0026 // Do not add multiple public overloads with optional parameters
{
var parser = ValueParsers.GetParser<T>();
Expand Down
2 changes: 1 addition & 1 deletion src/CommandLineUtils/CommandLineApplicationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static CommandOption<T> Option<T>(this CommandLineApplication app, string
/// <param name="optionType"></param>
/// <param name="configuration"></param>
/// <returns></returns>
public static CommandOption<T> Option<T>(this CommandLineApplication app, string template, string description, CommandOptionType optionType, Action<CommandOption> configuration)
public static CommandOption<T> Option<T>(this CommandLineApplication app, string template, string description, CommandOptionType optionType, Action<CommandOption<T>> configuration)
=> app.Option<T>(template, description, optionType, configuration, inherited: false);

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/CommandLineUtils/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ McMaster.Extensions.CommandLineUtils.CommandLineApplication.AllowArgumentSeparat
McMaster.Extensions.CommandLineUtils.CommandLineApplication.AllowArgumentSeparator.set -> void
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Argument(string! name, string! description, bool multipleValues = false) -> McMaster.Extensions.CommandLineUtils.CommandArgument!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Argument(string! name, string! description, System.Action<McMaster.Extensions.CommandLineUtils.CommandArgument!>! configuration, bool multipleValues = false) -> McMaster.Extensions.CommandLineUtils.CommandArgument!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Argument<T>(string! name, string! description, System.Action<McMaster.Extensions.CommandLineUtils.CommandArgument!>! configuration, bool multipleValues = false) -> McMaster.Extensions.CommandLineUtils.CommandArgument<T>!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Argument<T>(string! name, string! description, System.Action<McMaster.Extensions.CommandLineUtils.CommandArgument<T>!>! configuration, bool multipleValues = false) -> McMaster.Extensions.CommandLineUtils.CommandArgument<T>!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Arguments.get -> System.Collections.Generic.List<McMaster.Extensions.CommandLineUtils.CommandArgument!>!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.ClusterOptions.get -> bool
McMaster.Extensions.CommandLineUtils.CommandLineApplication.ClusterOptions.set -> void
Expand Down Expand Up @@ -148,7 +148,7 @@ McMaster.Extensions.CommandLineUtils.CommandLineApplication.Option(string! templ
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Option(string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType, System.Action<McMaster.Extensions.CommandLineUtils.CommandOption!>! configuration, bool inherited) -> McMaster.Extensions.CommandLineUtils.CommandOption!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Option(string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType, System.Action<McMaster.Extensions.CommandLineUtils.CommandOption!>! configuration) -> McMaster.Extensions.CommandLineUtils.CommandOption!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Option(string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType) -> McMaster.Extensions.CommandLineUtils.CommandOption!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Option<T>(string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType, System.Action<McMaster.Extensions.CommandLineUtils.CommandOption!>! configuration, bool inherited) -> McMaster.Extensions.CommandLineUtils.CommandOption<T>!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Option<T>(string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType, System.Action<McMaster.Extensions.CommandLineUtils.CommandOption<T>!>! configuration, bool inherited) -> McMaster.Extensions.CommandLineUtils.CommandOption<T>!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.OptionHelp.get -> McMaster.Extensions.CommandLineUtils.CommandOption?
McMaster.Extensions.CommandLineUtils.CommandLineApplication.OptionNameValueSeparators.get -> char[]!
McMaster.Extensions.CommandLineUtils.CommandLineApplication.OptionNameValueSeparators.set -> void
Expand Down Expand Up @@ -501,7 +501,7 @@ static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.OnE
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.OnValidationError(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, System.Action<System.ComponentModel.DataAnnotations.ValidationResult!>! action) -> void
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.OnValidationError(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, System.Func<System.ComponentModel.DataAnnotations.ValidationResult!, int>! action) -> void
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.Option<T>(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType, bool inherited) -> McMaster.Extensions.CommandLineUtils.CommandOption<T>!
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.Option<T>(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType, System.Action<McMaster.Extensions.CommandLineUtils.CommandOption!>! configuration) -> McMaster.Extensions.CommandLineUtils.CommandOption<T>!
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.Option<T>(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType, System.Action<McMaster.Extensions.CommandLineUtils.CommandOption<T>!>! configuration) -> McMaster.Extensions.CommandLineUtils.CommandOption<T>!
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.Option<T>(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType) -> McMaster.Extensions.CommandLineUtils.CommandOption<T>!
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.VerboseOption(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, string! template) -> McMaster.Extensions.CommandLineUtils.CommandOption!
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.VerboseOption(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app) -> McMaster.Extensions.CommandLineUtils.CommandOption!
Expand Down