feat: [#880] make commands accept multiple names#1498
Open
u-wlkjyy wants to merge 1 commit into
Open
Conversation
Allow make:* commands (make:command, make:controller, make:middleware, make:request) to create several files in a single invocation, e.g. `make:controller UserController OrderController`. - Add support/console.MakeNames helper that returns every positional argument, falling back to a single empty name so the interactive prompt still works when no argument is passed. - Refactor each make command's Handle to loop over MakeNames and create one file per name, extracting the per-name logic into a makeOne method. - A failure for one name (e.g. file already exists) is reported via ctx.Error but does not stop the remaining names, mirroring mkdir. - Add multi-name tests for each command, including a partial-failure case for make:controller.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1498 +/- ##
==========================================
+ Coverage 69.46% 69.48% +0.01%
==========================================
Files 378 378
Lines 29726 29743 +17
==========================================
+ Hits 20649 20666 +17
- Misses 8124 8125 +1
+ Partials 953 952 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
|
It should be goravel/goravel#880 |
hwbrzzl
reviewed
Jun 19, 2026
hwbrzzl
left a comment
Contributor
There was a problem hiding this comment.
Look good to me. Could you cover other comments to implement this feature in this PR or another, and add a screenshot to confirm if this feature works in the PR description?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This implements #880 — allow
make:*commands to accept multiple names so several files can be created in a single invocation, similar tomkdir:Changes
support/console.MakeNames— new helper that returns every positional argument. When no argument is passed it returns a single empty name soNewMakestill falls back to its interactive prompt, preserving the original single-name behavior.make:*command (make:command,make:controller,make:middleware,make:request) —Handlenow loops overMakeNamesand creates one file per name. The per-name logic is extracted into amakeOnemethod so the loop stays small and readable.ctx.Errorbut the remaining names are still processed, mirroringmkdir. This also makes the command more script-friendly.Backward compatibility
Fully backward compatible:
make:controller UserController→ unchanged (single name).make:controller(no arg) → still prompts interactively.Handlebehavior.Tests
Added multi-name tests for every command:
TestMakeCommand_MultipleNamesTestControllerMakeCommand_MultipleNamesTestControllerMakeCommand_MultipleNamesPartialFailure(verifies a failing name doesn't abort the rest)TestMiddlewareMakeCommand_MultipleNamesTestRequestMakeCommand_MultipleNamesAll existing tests still pass (existing
Argument(0)expectations updated toArguments()).Note
While writing
make:commandmulti-name tests I noticed a pre-existing issue unrelated to this change:make:command SomeNamewithout a sub-directory (e.g.CleanCachevsGoravel/CleanCache) ends up withGetPackageName() == "commands"and registers&commands.CleanCache{}, which corruptskernel.go. Existing single-name tests only cover the sub-directory form, so it wasn't caught. Happy to file a separate issue for that if useful — it's out of scope for #880.Fixes #880.