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

feature: alias make: commands #43

Merged
merged 4 commits into from
Mar 2, 2021
Merged

feature: alias make: commands #43

merged 4 commits into from
Mar 2, 2021

Conversation

ryangjchandler
Copy link
Member

@ryangjchandler ryangjchandler commented Mar 2, 2021

This PR introduces new aliases for all of the make:filament-* commands.

The transform from the original is simply removing the make:filament- prefix and using filament:* instead.

In terms of how it works, each command is extended and the signature is overwritten. The $hidden property is set to true as well so that the aliases don't show up in artisan list.

I placed them all in an Aliases namespace so that they're out of the way, but happy to move them out.

The command registration in the service provider is a bit messy. There might be a nicer way of doing it though, so that if an alias exists in the Filament\Commands\Aliases namespace, it's automatically registered. Although this would introduce a small overhead because each alias registration would be an additional Artisan::starting event listeners and therefore another Closure that needs to be invoked.

Let me know what you think!

@danharrin
Copy link
Member

Hey! Thanks for this. I think that the autodiscovery overhead would be manageable, since commands aren't booted outside of the console anyway. 👍

@ryangjchandler
Copy link
Member Author

ryangjchandler commented Mar 2, 2021

@danharrin Consider it done! Just need to make sure that the alias class has the same basename as the parent class, otherwise the auto discovery won't work.

I feel like Laravel's should have some support for aliasing commands out of the box without this hidden and extending hack.

@danharrin danharrin merged commit 0004e1e into filamentphp:main Mar 2, 2021
@danharrin
Copy link
Member

Awesome, LGTM!

@danharrin danharrin added the enhancement New feature or request label Mar 2, 2021
@ryangjchandler ryangjchandler deleted the feature/alias-commands branch March 2, 2021 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants