Task #3398

Are methods in CLI\Request still used?

Added by Robert Lemke over 12 years ago. Updated about 11 years ago.

Should have
Start date:
Due date:
% Done:


Estimated time:
PHP Version:
Has patch:


In the CLI Request I currently find these functions:

     * Sets the arguments given to this request.
     * @param array $arguments
     * @return void
     * @author Karsten Dambekalns <karsten@typo3.org>
    public function setCLIArguments(array $arguments) {

     * Returns the arguments given to the request.
     * @return array
     * @author Karsten Dambekalns <karsten@typo3.org>
    public function getCLIArguments() {

Are they still in use? Why do we need special arguments for CLI?


Updated by Karsten Dambekalns over 12 years ago

Hehe, from my OmniFocus:
  • rename to avoid confusion with arguments in request object
  • make it mandatory to register use of CLI arguments to get them

Updated by Karsten Dambekalns over 12 years ago

As for the "Why do we need special arguments for CLI?" see this explanation from my mail "Re: [TYPO3-team-core-v5] CLI support for controllers in sub-packages" from 2008-09-25 11:55:34 CEST

> 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]


[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.

Updated by Karsten Dambekalns over 12 years ago

  • Status changed from Needs Feedback to Resolved
  • % Done changed from 0 to 100

The methods stay (see above for reasons), explicit registration is nonsense (you need to explicitly fetch them anyway) and some renaming has been done in r2366.

Also available in: Atom PDF