PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Console » Console_Getargs » Bug #2445

Don't limit to $_SERVER['argv']

Details

Request #2445Don't limit to $_SERVER['argv']
Submitted2004-10-04 17:48 UTC
Frompearbugs at unspeakable dot net
Assignedscottmattocks
StatusClosed
PackageConsole_Getargs
PHP Version4.3.9
OSLinux
Roadmaps(Not assigned)

Comments

[2004-10-04 17:48 UTC] pearbugs at unspeakable dot net

Description:
------------
I'd love to use Getargs in the same way I can use Getopt, which is to say that I don't use it for $_SERVER['argv'] but rather to parse strings within a larger application.

Is there any way you could take a string argument in addition to the config argument?

[2004-10-04 17:52 UTC] pearbugs at unspeakable dot net

er s/string/array/

[2004-10-05 07:58 UTC] bmansion at mamasam dot com

I don't understand what you mean neither what you want to do.
If Getopt does the job, why not use this package ?

[2004-10-05 12:12 UTC] pearbugs at unspeakable dot net

Sorry, I had a feeling I was being unclear.

I don't want to continue using Getopt because it seems less flexible and has an annoying bug (that I've yet to report.)

I'm basically asking to be able to pass in the 'args' to Getargs instead of it being solely for $_SERVER['args'].

I've got a function that will take a string and split it up like a shell would (quoted strings and words and whatnot,) returning an array. I can pass user input into it and use the array that it returns as an argument to Console::Getopt. It would be great if I could do the same thing with the seemingly more flexible Getargs.

You could even write it so that if the user doesn't pass the arguments in, that it acts on $_SERVER['args'] as a default, and I'm sure you know that.

Sorry if this, too, is unclear!

[2004-10-05 12:21 UTC] bmansion at mamasam dot com

This can be interesting.
Now if you could provide a patch against the latest cvs version and a test file... :)
...Unless Scott got some time to deal with this request but I am not sure he is awake yet where he lives, so I suggest we wait a bit.
I don't have the time myself to take care of this at the moment.

[2004-10-05 12:24 UTC] christian at wenz dot org

since I am on the road for the next two weeks, I too would prefer a diff ATM ;-)

[2004-10-05 12:28 UTC] scott at crisscott dot com

I'm going to try and tackle requests as they come in. I should be able to resolve the previous one later today and then I will get to this.
It doesn't sound like it would be too much trouble to implement and I don't see any BC breaks that would arise. By Thursday I should be able to get this into CVS.