Skip to content

Consider a CliAction design that doesn't require custom implementations to override both Invoke and InvokeAsync methods #1934

Closed

Description

@jonsequitur
public abstract class CliAction
{
    public abstract int Invoke(ParseResult parseResult);
    public abstract Task<int> InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken = default);
}

Activity

  1. changed the title [-]Consider a design that doesn't require two methods (e.g. a delegate instead of an interface) when any given handler instance only needs one[/-] [+]Consider a `ICommandHandler` design that doesn't require both `Invoke` and `InvokeAsync` methods[/+] on Nov 2, 2022
  2. added
    needs discussion
    on Nov 2, 2022
  3. added this to the 2.0 GA milestone on Nov 9, 2022
  4. KalleOlaviNiemitalo commented on Mar 31, 2023

    @KalleOlaviNiemitalo

    ICommandHandler was replaced with CliAction in #2095, but this issue applies to that too.

  5. changed the title [-]Consider a `ICommandHandler` design that doesn't require both `Invoke` and `InvokeAsync` methods[/-] [+]Consider a `CliAction` design that doesn't require custom implementations to override both `Invoke` and `InvokeAsync` methods[/+] on Mar 31, 2023
  6. jonsequitur commented on Jul 1, 2025

    @jonsequitur
    ContributorAuthor

    This is resolved by CommandLineAction having two different implementations: SynchronousCommandLineAction and AsynchronousCommandLineAction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-APIneeds discussion

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions