Skip to content

Startup interceptors #1788

@ricardoboss

Description

@ricardoboss

Is your feature request related to a problem? Please describe.

I want to be able to print something every time my cli starts. With Spectre.Console.Cli, I would need to do that in every command handler instead of one, single place.

Describe the solution you'd like

I gave it a thought and think the ability to register a IStartupInterceptor in the type registrar would be nice. It would then be called directly after the command was processed but before the command is executed.

Describe alternatives you've considered

As I said earlier, without this, I would need to add this print (or anything else I want for every command) to each command individually. This is unnecessary, error prone and noisy.

Additional context

The IStartupInterceptor is akin to the ICommandInterceptor, so the concept itself is not foreign to the project.

In addition, it would be nice if both, the IStartupInterceptor and the ICommandInterceptor would be able to access the ITypeResolver, so they can run access any services they need without constructor injection.


Please upvote 👍 this issue if you are interested in it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo 🕑

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions