feat: show an error and terminate if there are no commands defined #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If no commands have been registered, it shows the user an error along with some notes to help them:
Why this check?
Because I had to struggle a little bit with this error:
Undefined array key 0 {"exception":"[object] (ErrorException(code: 0): Undefined array key 0 at /.../vendor/aaronfrancis/solo/src/Prompt/Dashboard.php:77)
.I encountered this error after installing solo in a Laravel 10 app recently upgraded to 11 where I manually needed to register
SoloServiceProvider
inconfig/app.php
(the "old" way).This PR could be useful to other users with a similar setup; it may also help those who have forgotten to define at least one command in the service provider (unlikely, but getting distracted is a snap 😅).
Please feel free to adjust the tone of voice of messages: they may sound too harsh 😇
Perhaps, there is also a better way (not in the constructor, I mean) to perform this little check and terminate.
Thanks for this fantastic package!