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

feat: show an error and terminate if there are no commands defined #12

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

eleftrik
Copy link
Contributor

@eleftrik eleftrik commented Nov 9, 2024

If no commands have been registered, it shows the user an error along with some notes to help them:

image

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 in config/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!

@aarondfrancis
Copy link
Owner

Great idea! I switched it up a bit to show the About comand, since that already shows some documentation. Thanks!

@aarondfrancis aarondfrancis merged commit a9b9396 into aarondfrancis:main Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants