Req #16679 [WFx]: Allow arguments to have Actions
| From: | izi@php.net | Date: | Tue, 08 Jun 2010 09:35:29 +0000 |
| Subject: | Req #16679 [WFx]: Allow arguments to have Actions | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-3899@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=16679&edit=1
ID: 16679
Updated by: izi@php.net
Reported By: RQuadling at GMail dot com
Summary: Allow arguments to have Actions
Status: Wont fix
Type: Feature/Change Request
Package: Console_CommandLine
Operating System: Irrelevant
Package Version: 1.1.0
PHP Version: 5_3 CVS-2009-10-05
Assigned To: izi
Roadmap Versions:
New Comment:
>> The main reason is that a common sequence of events is to ask for a
file or directory and then to
>> validate that the file or directory exists.
Yep but I can't see any other common usecase, furthermore sometimes you
want to provide a file that does not exists and will be created by the
script, like an output file.
>> The alternative is to create a parameter which requires a file name
and a custom action. But then
>> the parameter is no longer mandatory ...
Or you could just do:
if (!file_exists($parser->args['file'])) { ... }
Regards,
--
David
Previous Comments:
------------------------------------------------------------------------
[2010-06-07 10:26:02] rquadling
The main reason is that a common sequence of events is to ask for a
file or
directory and then to validate that the file or directory exists.
Allowing for this common use pattern would simplify the user's code in
that the
validation will already be done.
The alternative is to create a parameter which requires a file name and
a custom
action.
But then the parameter is no longer mandatory ...
Like for PHP...
php file.php
or
php -f file.php
the -f is redundant, but would be required for Console_CommandLine to
allow for a
custom action to verify the existence of file.php
------------------------------------------------------------------------
[2010-06-06 18:17:56] izi
-Status: Open
+Status: Wont fix
-Assigned To:
+Assigned To: izi
I'm not sure this feature request is a good idea, validating arguments
doesn't make
much sense, closing this as "won't fix".
------------------------------------------------------------------------
[2009-10-05 18:27:29] rquadling
Description:
------------
Quite often an argument will be a filename. Being able to specify
an action for an argument would be useful so you could verify
the supplied argument.
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=16679&edit=1