Change syntax to something like help and man pages
Closed this issue · 3 comments
mnapoli commented
Here is an example of a Symfony command help:
$ app/console help help
Usage:
help [--xml] [--format="..."] [--raw] [command_name]
This is also similar to what man
pages would show.
This syntax could be reused to define the commands.
- required argument:
foo
- optional argument:
[foo]
- multiple arguments:
[foo]*
or[foo]+
? - flag:
[--foo]
- option:
[--foo=]
- multiple option:
[--foo=]*
So, choice A:
$app->command('greet firstname [lastname] [--yell] [--format=]', function () {
// ...
});
vs choice B (current syntax):
$app->command('greet firstname lastname? --yell --format=', function () {
// ...
});
The current syntax is shorter, but maybe less easy to understand and remember?
juniwalk commented
I think that with A you can more easily distinguish between required and optional arguments. I am for A.
mnapoli commented
Done! :)
The readme will show the new syntax, I'll release v1 in the next days. Thanks for your feedback.