Re: [PEPr] Comment on Console::Console_Extend_Getargs

From: Date: Thu, 28 Oct 2004 14:27:58 +0000
Subject: Re: [PEPr] Comment on Console::Console_Extend_Getargs
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-34127@lists.php.net to get a copy of this message
Bertrand Mansion wrote:
<>Bertrand Mansion (http://pear.php.net/user/mansion) has commented on the proposal for Console::Console_Extend_Getargs. Comment: ... BTW, it is already possible to use something else than $_SERVER['argv']in Console_Getargs, just look at the constructor. Proposal information: http://pear.php.net/pepr/pepr-proposal-show.php?id=170 Ok, bertrand,
I totally agree, I will reconsider the way the extension is implemented. You will need to add before any output: require_once Console/'Extend_Optargs.php'; Keeping in: require_once 'Console/Getargs.php'; and then replace the call to Console_Getargs::Factory() instead of: $args = & Console_Getargs::factory($config); put: $args = & Console_Extend_Optargs::getArgv($config); We gain compatibility with anything, and independance of packages. That solve my plan to open it to Console_Getopt users: They will need to replace: $args = Console_Getopt::Getopt($args, $short_options, $long_options); by $args = Console_Extend_Optargs::getArgv($args, $short_options, $long_options); Even people not using Console_Getopt nor Console_Getargs but playing directly with argv in PHP from console could use it to build an argv over HTTP or WAP .... just saying: $args = Console_Extend_Optargs::getArgv(array('arg1' arg2' arg3')); or even $args = Console_Extend_Optargs::getArgv(5); // load 5 arguments freely wich would load argv directly Console_Extend_Optargs::getArgv() would automatically detect wich kind of argument is given and accordingly switch to Getargs, Getopt or nothing. Again Console_Extend_Optargs would do nothing if it's called from console but just return to the normal run. That's why I reconsider the package name too as you could see... regards bertrand Gugger (toggg)

« previous php.pear.dev (#34127) next »