I think having some command line tooling is definitely something we are
interested in investigating further. In fact it's one of our todos to
jump start this discussion after 1.0 ships along with some other
pressing issues like good Form support.
We've been heads down on polishing up the release but this will change
once we successfully ship 1.0.
Thanks for the feedback. Please keep watching the list so you can
participate in the proposals/discussions in a few weeks time.

Andi

> -----Original Message-----
> From: unknownman [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, June 20, 2007 3:35 AM
> To: [email protected]
> Subject: [fw-general] Zend Framework Cli Tool
> 
> 
> one of the great tool for rails is the its great script 
> directory that you can make big project in a minute i start 
> writting a cli program like it.
> i write a class (it is like dispatcher in MVC model for shell 
> program) <?php // zct.php require_once 
> 'Zend/Console/Getopt.php'; class ZCT {
>       protected $options;
>       protected $cli;
>       
>       function __construct($options) {
>               $this->cli = new Zend_Console_Getopt($options);
>               $this->options = $options;
>       }
>       
>       function execute() {
>               $fileName = substr(
>                                                  
$_SERVER['SCRIPT_FILENAME'],
>                                                  strrpos(
>                                                               
>    $_SERVER['SCRIPT_FILENAME'],
>                                                               
>    DIRECTORY_SEPARATOR
>                                                                  )+1
>                                                  );
>               $directory = dirname(__FILE__).DIRECTORY_SEPARATOR;
>               require_once $directory.'operator/'.$fileName;
>               
>               $className = 
> 'Zct_Operator_'.str_replace('.php','',$fileName);
>               $obj= new $className($this->cli, $this->options);
>               $obj->_prefilter();
>               foreach($this->cli->toArray() as $option) {
>                       $operate = $option.'Operator';
>                       $obj->$operate();
>               }
>               $obj->_postfilter();
>       }
> }
> 
> every work you want to do have 2 section an script file and a 
> operator class
> 
> //script file generate.php
> #!/usr/bin/env php
> <?php
> /**
>  * Zend Command Line Tool - Generator
>  *
>  * This file 's duty is to make new project
>  * with zend framework
>  *
>   * @copyright  2005 Zend Technologies
>  * @license    http://www.zend.com/license/3_0.txt   PHP License 3.0
>  * @since      File available since Release 1.0.0RC2
>  */
> $options = array(
>                                 'force|f'                     
> => 'Overwrite files that already exist',
>                                 'help|h'                      
> => 'Show this help message and quit',
>                                 'version|v'                  
> => 'Show the ZCT version number and quit',
>                                 'backtrace|t'               
> => 'Debugging: show backtraces on errors'
>                               );
> 
> require_once '../zct.php';                                    
>                  
> $base = new Zct($options);
> $base->execute();
> and the operator class is like this 
> 
> <?php
> class ZCT_Operator_Generate {
>       function __construct() {
>               
>       }
>       
>       function _prefilter() {
>               echo 'this is prefilter'."\n";
>       }
>       
>       function helpOperator() {
>               echo 'help content';
>       }
>       
>       function _postfilter() {
>               echo 'this is postfilter'."\n";
>       }
> }
> </code>
> then if we write in cli ./scripts/generate.php help we will see
> helpOperator() 
> http://www.nabble.com/file/p11210754/zct.tar.gz zct.tar.gz
> --
> View this message in context: 
> http://www.nabble.com/Zend-Framework-Cli-Tool-tf3951538s16154.
html#a11210754
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> 

Reply via email to