sync
authorAlan Knowles <alan@roojs.com>
Thu, 25 Oct 2018 03:36:22 +0000 (11:36 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 25 Oct 2018 03:36:22 +0000 (11:36 +0800)
HTML/FlexyFramework.php
HTML/FlexyFramework/Cli.php
HTML/FlexyFramework2.php
HTML/FlexyFramework2/Cli.php

index bf5459c..3e2e131 100755 (executable)
@@ -153,7 +153,7 @@ class HTML_FlexyFramework {
             $this->$k = $v;
         }
         $this->_parseConfig();
-        
+
         // echo '<PRE>'; print_r($this);exit;
         if ($this->cli) {
             $args = $_SERVER['argv'];
@@ -162,7 +162,7 @@ class HTML_FlexyFramework {
             $this->_run($this->run,false,$args);
             return;
         }
-    
+
         // handle apache mod_rewrite..
         // it looks like this might not work anymore..
         
@@ -298,8 +298,7 @@ RewriteRule ^(.+)$ /web.hpasite/index.local.php [L,NC,E=URL:$1]
         }
         
          $this->classPrefix   = str_replace('/', '_', $this->project) . '_';
-        
-        // list the available options..
+         // list the available options..
         if ($this->cli && empty($_SERVER['argv'][1])) {
             require_once 'HTML/FlexyFramework/Cli.php';
             $fcli = new HTML_FlexyFramework_Cli($this);
@@ -344,7 +343,7 @@ RewriteRule ^(.+)$ /web.hpasite/index.local.php [L,NC,E=URL:$1]
         }
 
         $this->_validateDatabase();
+
         $this->_validateTemplate();
         
     }
@@ -1043,6 +1042,7 @@ RewriteRule ^(.+)$ /web.hpasite/index.local.php [L,NC,E=URL:$1]
         
         // echo '<PRE>'; print_r($this);exit;
         // echo "CHECK GET AUTH?";
+
         if (!method_exists($classobj, 'getAuth')) {
         //    echo "NO GET AUTH?";
             $this->fatalError("class $classname does not have a getAuth Method");
@@ -1070,6 +1070,7 @@ RewriteRule ^(.+)$ /web.hpasite/index.local.php [L,NC,E=URL:$1]
                 return $result;
             }
         }
+                    
         /* allow redirect from start */
         if (method_exists($classobj,"start")) {
             if (is_string($redirect = $classobj->start($subRequest,$isRedirect,$args)))  {
index 7243647..d2e3654 100644 (file)
@@ -294,8 +294,11 @@ Available commands:
         require_once 'Console/Getargs.php';
         $ar = $_SERVER['argv'];
         $call = array(array_shift($ar)); // remove index.php
-        $call[] = array_shift($ar); 
-        //var_dump($ar);
+        $has_class = false;
+        if (isset($ar[0]) && $ar[0][0] != '-') {
+            $call[] = array_shift($ar); // remove our class...
+            $has_class = true;
+        }  
         $val = self::$cli_opts;
         
         $newargs = Console_Getargs::factory($val, $ar);
@@ -317,8 +320,12 @@ Available commands:
                 exit;
             }
             if ($newargs->getCode() === CONSOLE_GETARGS_HELP) {
-                
-                return true;// hel
+                if (!$has_class) {
+                    echo Console_Getargs::getHelp($val,
+                            $helpHeader, NULL, 78, 4)."\n\n";
+                    exit;
+                }
+                return true;// help is handled later in the flow?
             }
             
             return false;
@@ -332,8 +339,8 @@ Available commands:
         foreach($ret as $k=>$v) {
             switch($k) {
                 case 'pman-nodatabase':
-                    //echo "Turning off database";
-                    $this->ff->nodatabase= true;
+                    echo "Turning off database\n";
+                    $this->ff->nodatabase = true;
                     
                     break;
                 
index d0b5569..26f9d95 100644 (file)
@@ -561,6 +561,7 @@ class HTML_FlexyFramework2 {
         $generator = new HTML_FlexyFramework2_Generator();
         $generator->start();
         
+        $this->debug('generateDataobjectsCache', 'dataObjectsCache  writing');
         HTML_FlexyFramework2_Generator::writeCache($iniCacheTmp, $iniCache); 
         // reset the cache to the correct lcoation.
         PDO_DataObject::config('schema_location',  $iniCache);
index 2c371ba..98276c2 100644 (file)
@@ -10,7 +10,8 @@
  *   $x = new HTML_FlexyFramework_Cli($ff);
  *   $x->cliHelp(); // summary of all classes which can be run with cli.
  *             (contain static $cli_desc)
- *   $x->cliParse($classname);
+ *   $x->cliParse($classname); // parses once we know the class name..
+ *   $x->parseDefaultOpts(); // handles pman-nodatabase
  *
  *
  */
@@ -187,7 +188,7 @@ Available commands:
     */
     function cliParse($classname)
     {
-        die("here");
+        
     // cli static $classname::$cli_opts
         try {
             // look up the parent tree for core opts.
@@ -290,7 +291,11 @@ Available commands:
         require_once 'Console/Getargs.php';
         $ar = $_SERVER['argv'];
         $call = array(array_shift($ar)); // remove index.php
-        $call[] = array_shift($ar); 
+        $has_class = false;
+        if (isset($ar[0]) && $ar[0][0] != '-') {
+            $call[] = array_shift($ar); // remove our class...
+            $has_class = true;
+        } 
         //var_dump($ar);
         $val = self::$cli_opts;
         
@@ -313,7 +318,11 @@ Available commands:
                 exit;
             }
             if ($newargs->getCode() === CONSOLE_GETARGS_HELP) {
-                
+                if (!$has_class) {
+                    echo Console_Getargs::getHelp($val,
+                            $helpHeader, NULL, 78, 4)."\n\n";
+                    exit;
+                }
                 return true;// hel
             }
             
@@ -325,19 +334,19 @@ Available commands:
         
         
         $ret =  $newargs->getValues();
-            foreach($ret as $k=>$v) {
-                switch($k) {
-                    case 'pman-nodatabase':
-                        //echo "Turning off database";
-                        $this->ff->nodatabase= true;
-                        
-                        break;
+        foreach($ret as $k=>$v) {
+            switch($k) {
+                case 'pman-nodatabase':
+                      echo "Turning off database\n";
+                    $this->ff->nodatabase= true;
                     
-                    default:
-                        die("need to fix option $k");
-                }
+                    break;
                 
+                default:
+                    die("need to fix option $k");
             }
+            
+        }
         return false;
         
     }