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

CommandHandler.Create() to handle more than 7 parameters. #536

Closed
wants to merge 3 commits into from
Closed
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
239 changes: 192 additions & 47 deletions src/System.CommandLine/Invocation/CommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// WARINING: Generated code.

using System.CommandLine.Binding;
using System.Reflection;
Expand All @@ -15,125 +16,269 @@ public static class CommandHandler
public static ICommandHandler Create(Action action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T>(
Action<T> action) =>
public static ICommandHandler Create(Func<int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create(Func<Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create(Func<Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1>(
Action<T1> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1>(
Func<T1, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1>(
Func<T1, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1>(
Func<T1, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2>(
Action<T1, T2> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2>(
Func<T1, T2, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2>(
Func<T1, T2, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2>(
Func<T1, T2, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3>(
Action<T1, T2, T3> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3>(
Func<T1, T2, T3, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3>(
Func<T1, T2, T3, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3>(
Func<T1, T2, T3, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4>(
Action<T1, T2, T3, T4> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4>(
Func<T1, T2, T3, T4, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4>(
Func<T1, T2, T3, T4, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4>(
Func<T1, T2, T3, T4, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5>(
Action<T1, T2, T3, T4, T5> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5>(
Func<T1, T2, T3, T4, T5, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5>(
Func<T1, T2, T3, T4, T5, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5>(
Func<T1, T2, T3, T4, T5, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6>(
Action<T1, T2, T3, T4, T5, T6> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6>(
Func<T1, T2, T3, T4, T5, T6, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6>(
Func<T1, T2, T3, T4, T5, T6, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6>(
Func<T1, T2, T3, T4, T5, T6, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7>(
Action<T1, T2, T3, T4, T5, T6, T7> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create(Func<int> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7>(
Func<T1, T2, T3, T4, T5, T6, T7, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T>(
Func<T, int> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7>(
Func<T1, T2, T3, T4, T5, T6, T7, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2>(
Func<T1, T2, int> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7>(
Func<T1, T2, T3, T4, T5, T6, T7, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3>(
Func<T1, T2, T3, int> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8>(
Action<T1, T2, T3, T4, T5, T6, T7, T8> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4>(
Func<T1, T2, T3, T4, int> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5>(
Func<T1, T2, T3, T4, T5, int> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6>(
Func<T1, T2, T3, T4, T5, T6, int> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7>(
Func<T1, T2, T3, T4, T5, T6, T7, int> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
Action<T1, T2, T3, T4, T5, T6, T7, T8, T9> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create(Func<Task> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T>(
Func<T, Task> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2>(
Func<T1, T2, Task> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3>(
Func<T1, T2, T3, Task> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4>(
Func<T1, T2, T3, T4, Task> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5>(
Func<T1, T2, T3, T4, T5, Task> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6>(
Func<T1, T2, T3, T4, T5, T6, Task> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7>(
Func<T1, T2, T3, T4, T5, T6, T7, Task> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(
Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create(Func<Task<int>> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T>(
Func<T, Task<int>> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2>(
Func<T1, T2, Task<int>> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3>(
Func<T1, T2, T3, Task<int>> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(
Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4>(
Func<T1, T2, T3, T4, Task<int>> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5>(
Func<T1, T2, T3, T4, T5, Task<int>> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6>(
Func<T1, T2, T3, T4, T5, T6, Task<int>> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7>(
Func<T1, T2, T3, T4, T5, T6, T7, Task<int>> action) =>
public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(
Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(
Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(
Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(
Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, int> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, Task> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

public static ICommandHandler Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(
Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, Task<int>> action) =>
HandlerDescriptor.FromDelegate(action).GetCommandHandler();

internal static async Task<int> GetResultCodeAsync(object value, InvocationContext context)
Expand Down
Loading