[10.x] Generate default command name based on class name #46256
Merged
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.
This PR changes the default
command:name
based on the current app namespace and the command class name.I know there is a
--command
option, but – at least for me – it feels a bit more streamlined generating a default command name based on the given class.For example the
php artisan make:command MigrateOldDb
will generate$signature = 'app:migrate-old-db'
.Right now, it uses the application namespace. So, when changing from the default
App
namespace, the generated command signature will change as well. For example if the base namespace isLaravel\Forge
, the generated command signature will belaravel-forge:migrate-old-db
.To simplify this, we might just use the
app:
prefix, since by using the--command
option, the command name can be changed easily.I didn't find tests related to the
make:*
commands. Am I missing something? If you're willing to merge, I would gladly add some tests as well.Thanks.