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

Startup interceptors #1788

Open
ricardoboss opened this issue Mar 31, 2025 · 0 comments · May be fixed by #1789
Open

Startup interceptors #1788

ricardoboss opened this issue Mar 31, 2025 · 0 comments · May be fixed by #1789

Comments

@ricardoboss
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo 🕑
Development

Successfully merging a pull request may close this issue.

1 participant