Re: Console_Getopt and 'ambiguous' options
| From: | Greg Beaver | Date: | Fri, 04 Nov 2005 15:41:27 +0000 |
| Subject: | Re: Console_Getopt and 'ambiguous' options | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-21778@lists.php.net to get a copy of this message | ||
Jocke Selin wrote:
> Gents, and probably directly Andrei,
>
> We've been using Console_Getopts to quite a big success - it's very
> nice to use a package like this and not have to worry about decoding
> the user input, but instead be able to focus on the real development
> work.
>
> Recently we extended the functionality of one of our scripts, and we
> started getting these error messages about being ambiguous:
> Error: Console_Getopt: option --type is ambiguous.
>
> After a bit of head scratching I notice that this is actually expected
> behaviour in the manual.
>
> http://pear.php.net/manual/en/package.console.console-getopt.getopt.php
> ---
> Error code Error message Reason Solution
> NULL "Console_Getopt: option --$opt is ambiguous" Two or more long
> options starts with the same character. Change the naming of the
> options. It is also possible that the error is caused by a typing
> mistake.
> ---
>
> What's the reson for this (shortcoming)? (AFAIK this limits the
> options to 26 [english])
don't forget digits ;)
Seriously though, perhaps your project might benefit from the use of
another model, such as the command pattern used by PEAR itself.
The reason short options must be a single character is because it is
possible to do:
command -asdfieo
This works exactly like:
command -a -s -d -f -i -e -o
Greg