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

[5.7] Enable passing options to custom presets #25930

Merged
merged 2 commits into from Oct 5, 2018

Conversation

Projects
None yet
2 participants
@connectkushal

connectkushal commented Oct 4, 2018

The ability to create our own presets is very convenient. But currently it is not possible to have customization in the user made preset commands by passing options to it. For example if i am making a preset for tachyon css and want the dev to choose a js framework from either vue or react along with the choice of creating auth pages or not, its not possible with php artisan preset tachyon alone.

This pr enables passing of multiple values to the custom presets through --option=, which can be used as ...
php artisan preset tachyon --option=vue --option=cdn --option=version:4.0 or
php artisan preset tachyon --option=react --option=auth
.
This opens many possibilities for creating presets which will simplify and make frontend dev much faster.

This is a non breaking change and works as intended without affecting the default presets.


The array of values passed can be accessed in the following way.

PresetCommand::macro('tachyon', function($command){
    $options =  $command->option('option'), 
    ....
    ....
});

Enable passing options to custom presets
Currently it is not possible to create custom presets with customization
@taylorotwell

This comment has been minimized.

Show comment
Hide comment
@taylorotwell

taylorotwell Oct 4, 2018

Member

Why not just something like option?

Member

taylorotwell commented Oct 4, 2018

Why not just something like option?

@connectkushal

This comment has been minimized.

Show comment
Hide comment
@connectkushal

connectkushal Oct 4, 2018

@taylorotwell i'll update the description and name if option seems more appropriate.

connectkushal commented Oct 4, 2018

@taylorotwell i'll update the description and name if option seems more appropriate.

@taylorotwell

This comment has been minimized.

Show comment
Hide comment
@taylorotwell

taylorotwell Oct 4, 2018

Member

I would prefer option over pass.

Member

taylorotwell commented Oct 4, 2018

I would prefer option over pass.

@connectkushal

This comment has been minimized.

Show comment
Hide comment
@connectkushal

connectkushal commented Oct 4, 2018

@taylorotwell taylorotwell merged commit 25f8840 into laravel:5.7 Oct 5, 2018

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@connectkushal connectkushal deleted the connectkushal:patch-1 branch Oct 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment