[TYPO3-team-core-v5] CLI support for controllers in sub-packages
Karsten Dambekalns
karsten at typo3.org
Thu Sep 25 11:55:34 CEST 2008
Hi Bastian.
Bastian Waidelich wrote:
> you were too fast for me at least.. I didn't really get the difference
> between options and arguments. Do we need to separate them at all?
Yes, we do.
Consider some command that accepts a bunch of files as input. You do
probably not want to add one option per file. And adding more than one
value to one option is also bad style IMHO.
So, let's use a lame example: Assume we have ls (dir for you ;) as part
of some FLOW3 shell-emulator. How do you write this in a FLOW3 call:
ls -G *.jpg
(Keep in mind the wildcard is expanded by the shell, so FLOW3 receives a
list of arguments, not the literal "*.jpg"!)
I'd expect this:
php index.php shell file ls -G -- *.jpg
(I admit the -- is ugly here, but we don't know if -G accepts a value)
The alternative would be to add some option, say "subject":
php index.php shell file ls -G --subject *.jpg
Now you'd need to explode(' ', $subject). Bah. Or, even worse:
php index.php shell file ls -G --subject one.jpg --subject2 two.jpg ...
Argh, right?
Anyway, I hope at least I could explain the difference between options
and arguments.[1]
Karsten
[1] Another way: options is what you specify like "\b" in DOS, arguments
is what you simply gibe to your command.
[2] Yet another way: options is "how", arguments is "with what" - more
or less.
More information about the TYPO3-team-core-v5
mailing list