-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
Feature: Add bootstrap hook #576
Feature: Add bootstrap hook #576
Conversation
I'm not against this, but my concerns:
The point of hooks in Scribe is to not just tell you when something is happening, but give you tools to adjust it. As it stands, this is just a case of "run this code before you run the actual command", which doesn't seem like such a compelling use case to me. You can easily do that by the ways you mentioned or by creating your own subclass of the command. A third concern is the name. The |
Oops, big fingers closed by mistake. If the argument is that it's more convenient to add some code in your service provider than to create a new command, I can understand that.😄 In which case, I'd accept this with a few changes:
|
Hey thanks for taking the time to review the PR 😃 I understand your concerns and I'll do the following:
|
This isn't a bad idea, but since we've been exposing APIs via a single class, Scribe, I'd like to keep it that way. Your concern about the generic name is correct, but the multiple commands are really just "support" commands. They don't have a lot of logic and don't really need any user tinkering. So I think
Not sure what exactly a setter would be for here (modifying the config? I'm not sure I want to encourage that pattern.). Either way, yeah, let's just keep it simple and pass the command instance. |
Sounds good 👍 I've updated the PR |
Can you send a docs PR as well? This is the page: https://scribe.knuckles.wtf/laravel/hooks. You can probably just click |
@shalvah I created a PR on the docs repo. |
Released 4.10.0 |
I think it'll be useful to have a
beforeGenerating
callback/hook.It can be used to replace a service container binding or fake certain events for example.
I think it's a better option instead of listening to the default Laravel
CommandStarting
event and checking on the command type. Especially since the package already provides anafterGenerating
callback.