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

[9.x] Change class option to argument #35536

Closed

Conversation

jasonmccreary
Copy link
Contributor

A long standing paper-cut for me has been the --class option for the db:seed command. Most other artisan commands accept an argument for the subject.

This PR converts the class option to an argument. It has the same default (Database\Seeders\DatabaseSeeder). Just saves on typing to improve the developer experience.

Before

php artisan db:seed --class=UsersTableSeeder

After

php artisan db:seed UsersTableSeeder

@GrahamCampbell GrahamCampbell changed the title Change class option to argument [9.x] Change class option to argument Dec 8, 2020
@GrahamCampbell
Copy link
Member

I don't think this break is worth it? At the least, we should support both the old and new syntax for a few years.

@GrahamCampbell GrahamCampbell marked this pull request as draft December 8, 2020 16:31
@jasonmccreary
Copy link
Contributor Author

@GrahamCampbell I wouldn't think carrying both options for years is worth it. 😉 However, if it means the argument could be merged into 8.x, then I'm all for it. 😂

@Davidnadejdin
Copy link

Davidnadejdin commented Dec 16, 2020

@GrahamCampbell I wouldn't think carrying both options for years is worth it. 😉 However, if it means the argument could be merged into 8.x, then I'm all for it. 😂

your option forces you to preserve a certain order of arguments, which can interfere with optional arguments. Therefore, the old syntax is still valid

@driesvints
Copy link
Member

@jasonmccreary can you rebase with master? After that feel free to markt his PR as ready for review. Taylor doesn't sees draft PRs.

@jasonmccreary
Copy link
Contributor Author

jasonmccreary commented Dec 16, 2020

@driesvints, no problem. Didn't realized I marked it as draft. 😅

@jasonmccreary
Copy link
Contributor Author

jasonmccreary commented Dec 16, 2020

@Davidnadejdin not sure who your comment was intended for, however, neither the before nor after versions require ordering the parameters as far as I'm aware.

@jasonmccreary jasonmccreary marked this pull request as ready for review December 16, 2020 15:29
@Davidnadejdin
Copy link

@Davidnadejdin not sure who your comment was intended for, however, neither the before nor after versions require ordering the parameters as far as I'm aware.

I thought that you are proposing to globally change the way of passing arguments to commands, sorry

@taylorotwell
Copy link
Member

Hmm, I'm also not sure I'm willing to take on the breaking change unless it has more clear user benefit.

@jasonmccreary
Copy link
Contributor Author

@taylorotwell would you be open to supporting both syntaxes as suggested by Graham.

I feel this has user benefit in the obvious less keystrokes, but more importantly the symmetry with other artisan commands. I can't be the only Laravel developer to mistakenly type artisan db:seed UserTableSeeder over the years. 😅

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.

5 participants