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

use colons to separate commands in a shell #617

Closed
ghost opened this issue Sep 5, 2017 · 2 comments
Closed

use colons to separate commands in a shell #617

ghost opened this issue Sep 5, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 5, 2017

Hi,
wouldn't it be nice to use the methods from php always with colons? i.e.

function doAnythingForMe() will be do:anything-for-me and not do:anything:for:me

@amenk
Copy link
Contributor

amenk commented Sep 5, 2017

I also would be happy if it works like that - as it is in php artisan for example.

@greg-1-anderson
Copy link
Member

Changing the default naming mapping from PHP function names to command names would be a backwards-compatible-breaking change. This would have to happen in Robo 2.0, which at the moment does not even have a timeline. The items from #548 are being done in a backwards-compatible way. If you do not like the command name that Robo gives you by default, then you can use a @command annotation. I have taken to annotating the exact command name that I want to avoid ambiguity.

As far as command naming conventions, do:anything:for:me does not follow any of the conventions usually followed by Symfony Console tools. A typical pattern is:

section-name:specific-action

So, you might have commands such as house:create, house:tear-down and house:paint, coupled with car:drive, car:oil-change, and maybe strengthening-medicine:drink. This allows you to run mytool list strengthening-medicine to see all of the things you can do with that category of commands.

Along these lines, the command "section names" will appear in multiple commands, so it is best to choose short single words for them. Also, while it is completely possible to have three command sections (e.g. site:org:add and site:team:list in Terminus), most simple tools will have only two sections of commands, so I think that the current Robo defaults are best.

I realize that this decision is purely arbitrary. If you are in the habit of making tools that have a lot of command sections, and you are good at picking short single words for each part, then the here proposal makes sense. It really depends on what sort of commands you're writing, though. At one time I even suggested the opposite -- that most simple Robo commandfiles would not have multipe command sections, and we should just default to all commands as do-anything-for-me. Fortunately, @DavertMik rejected this suggestion, as I now think that would have been a mistake as well.

I'm going to go ahead an close this, because Robo 2.x is nowhere on the horizon, and this is too minor an issue to keep open indefinitely. If folks feel strongly, we can resume the discussion when a 2.x version is being made.

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

No branches or pull requests

2 participants