Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 console command arguments vs options when to use what

Tags:

symfony

I would like to know of any guidelines to use input argument vs input options for passing in data to the symfony console command.

http://symfony.com/doc/current/components/console/introduction.html

I think arguments are to be used when the passed data is required for the command to execute, else use options.

Can you guys throw more light on this? What's the standard ?

like image 530
Venkat Kotra Avatar asked Jun 04 '14 10:06

Venkat Kotra


1 Answers

I would suggest use Arguments when You want to specify excecution-required values, like:

bin/console vendor:delete-entity 120

but not

bin/console vendor:delete-entity --id=120

You can use Options, when You want to alter the default execution scenario, like:

bin/console vendor:delete-entity 120 --dump-sql

or

bin/console vendor:bulk-create something --batch-size=100
like image 146
Valentas Avatar answered Sep 30 '22 14:09

Valentas