Skip to content

Commit 7f8553f

Browse files
authored
fix: pass the generic argument version in callback on .Option() and .Argument() (#405)
1 parent 23d18cf commit 7f8553f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/CommandLineUtils/CommandLineApplication.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ public CommandOption Option(string template, string description, CommandOptionTy
578578
/// <param name="inherited"></param>
579579
/// <typeparam name="T">The type of the values on the option</typeparam>
580580
/// <returns>The option</returns>
581-
public CommandOption<T> Option<T>(string template, string description, CommandOptionType optionType, Action<CommandOption> configuration, bool inherited)
581+
public CommandOption<T> Option<T>(string template, string description, CommandOptionType optionType, Action<CommandOption<T>> configuration, bool inherited)
582582
{
583583
var parser = ValueParsers.GetParser<T>();
584584

@@ -642,7 +642,7 @@ public CommandArgument Argument(string name, string description, Action<CommandA
642642
/// <param name="multipleValues"></param>
643643
/// <typeparam name="T">The type of the values on the option</typeparam>
644644
/// <returns></returns>
645-
public CommandArgument<T> Argument<T>(string name, string description, Action<CommandArgument> configuration, bool multipleValues = false)
645+
public CommandArgument<T> Argument<T>(string name, string description, Action<CommandArgument<T>> configuration, bool multipleValues = false)
646646
#pragma warning restore RS0026 // Do not add multiple public overloads with optional parameters
647647
{
648648
var parser = ValueParsers.GetParser<T>();

src/CommandLineUtils/CommandLineApplicationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static CommandOption<T> Option<T>(this CommandLineApplication app, string
5959
/// <param name="optionType"></param>
6060
/// <param name="configuration"></param>
6161
/// <returns></returns>
62-
public static CommandOption<T> Option<T>(this CommandLineApplication app, string template, string description, CommandOptionType optionType, Action<CommandOption> configuration)
62+
public static CommandOption<T> Option<T>(this CommandLineApplication app, string template, string description, CommandOptionType optionType, Action<CommandOption<T>> configuration)
6363
=> app.Option<T>(template, description, optionType, configuration, inherited: false);
6464

6565
/// <summary>

src/CommandLineUtils/PublicAPI.Shipped.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ McMaster.Extensions.CommandLineUtils.CommandLineApplication.AllowArgumentSeparat
104104
McMaster.Extensions.CommandLineUtils.CommandLineApplication.AllowArgumentSeparator.set -> void
105105
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Argument(string! name, string! description, bool multipleValues = false) -> McMaster.Extensions.CommandLineUtils.CommandArgument!
106106
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Argument(string! name, string! description, System.Action<McMaster.Extensions.CommandLineUtils.CommandArgument!>! configuration, bool multipleValues = false) -> McMaster.Extensions.CommandLineUtils.CommandArgument!
107-
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>!
107+
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>!
108108
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Arguments.get -> System.Collections.Generic.List<McMaster.Extensions.CommandLineUtils.CommandArgument!>!
109109
McMaster.Extensions.CommandLineUtils.CommandLineApplication.ClusterOptions.get -> bool
110110
McMaster.Extensions.CommandLineUtils.CommandLineApplication.ClusterOptions.set -> void
@@ -148,7 +148,7 @@ McMaster.Extensions.CommandLineUtils.CommandLineApplication.Option(string! templ
148148
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!
149149
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!
150150
McMaster.Extensions.CommandLineUtils.CommandLineApplication.Option(string! template, string! description, McMaster.Extensions.CommandLineUtils.CommandOptionType optionType) -> McMaster.Extensions.CommandLineUtils.CommandOption!
151-
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>!
151+
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>!
152152
McMaster.Extensions.CommandLineUtils.CommandLineApplication.OptionHelp.get -> McMaster.Extensions.CommandLineUtils.CommandOption?
153153
McMaster.Extensions.CommandLineUtils.CommandLineApplication.OptionNameValueSeparators.get -> char[]!
154154
McMaster.Extensions.CommandLineUtils.CommandLineApplication.OptionNameValueSeparators.set -> void
@@ -501,7 +501,7 @@ static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.OnE
501501
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.OnValidationError(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, System.Action<System.ComponentModel.DataAnnotations.ValidationResult!>! action) -> void
502502
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.OnValidationError(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, System.Func<System.ComponentModel.DataAnnotations.ValidationResult!, int>! action) -> void
503503
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>!
504-
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>!
504+
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>!
505505
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>!
506506
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.VerboseOption(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app, string! template) -> McMaster.Extensions.CommandLineUtils.CommandOption!
507507
static McMaster.Extensions.CommandLineUtils.CommandLineApplicationExtensions.VerboseOption(this McMaster.Extensions.CommandLineUtils.CommandLineApplication! app) -> McMaster.Extensions.CommandLineUtils.CommandOption!

0 commit comments

Comments
 (0)