Re: Console_Getopt changes
| From: | Stig S. Bakken | Date: | Thu, 23 May 2002 21:37:19 +0000 |
| Subject: | Re: Console_Getopt changes | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6373@lists.php.net to get a copy of this message | ||
I just fixed some broken behaviour in getopt (it would keep on parsing
options in the entire argument array, even past non-option entries), but
it's inconsistent with POSIX getopt(3) now because it does not skip the
first element. Since the new version has not been released anywhere
yet, I think I'll change it once more to make it POSIX-sane.
The change will (heads up Tomas :-) that you no longer will need to do
array_shift($argv); before getopt($argv, ...);
- Stig
On Thu, 2002-05-23 at 12:30, Sebastian Bergmann wrote:
> Recently the API of Console_Getopt changed.
>
> This code
>
> $options = Console_Getopt::getopt(
> $argv,
> '',
> array(
> 'format=',
> 'language=',
> 'no-highlighting',
> 'processor='
> )
> );
>
> print_r($options);
>
> now gives me
>
> Array
> (
> [0] => Array
> (
> )
>
> [1] => Array
> (
> [0] => build.php
> [1] => --format
> [2] => all
> [3] => --language
> [4] => all
> )
>
> )
>
> when called with
>
> --format all --language all
>
> as $argv.
>
> Is this the intended behaviour?
>
> --
> Sebastian Bergmann
> http://sebastian-bergmann.de/
> http://phpOpenTracker.de/
>
> Did I help you? Consider a gift:
> http://wishlist.sebastian-bergmann.de/
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php