[ Index ]

PHP Cross Reference of Automap

title

Body

[close]

/Automap/CLI/ -> Options.php (source)

   1  <?php
   2  //=============================================================================
   3  //
   4  // Copyright Francois Laupretre <automap@tekwire.net>
   5  //
   6  //   Licensed under the Apache License, Version 2.0 (the "License");
   7  //   you may not use this file except in compliance with the License.
   8  //   You may obtain a copy of the License at
   9  //
  10  //       http://www.apache.org/licenses/LICENSE-2.0
  11  //
  12  //   Unless required by applicable law or agreed to in writing, software
  13  //   distributed under the License is distributed on an "AS IS" BASIS,
  14  //   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15  //   See the License for the specific language governing permissions and
  16  //   limitations under the License.
  17  //
  18  //=============================================================================
  19  /**
  20  * @copyright Francois Laupretre <automap@tekwire.net>
  21  * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, V 2.0
  22  * @category Automap
  23  * @package Automap
  24  *///==========================================================================
  25  
  26  //=============================================================================
  27  /**
  28  * This class manages command line options for Automap\CLI\Cmd
  29  *
  30  * API status: Private
  31  * Included in the PHK PHP runtime: No
  32  * Implemented in the extension: No
  33  *///==========================================================================
  34  
  35  namespace Automap\CLI {
  36  
  37  if (!class_exists('Automap\CLI\Options',false)) 
  38  {
  39  class Options extends \Phool\Options\Base
  40  {
  41  
  42  // Short/long modifier args
  43  
  44  protected $opt_modifiers=array(
  45      array('short' => 'v', 'long' => 'verbose', 'value' => false),
  46      array('short' => 'q', 'long' => 'quiet'  , 'value' => false),
  47      array('short' => 'm', 'long' => 'map_path'  , 'value' => true),
  48      array('short' => 'b', 'long' => 'base_path'  , 'value' => true),
  49      array('short' => 'a', 'long' => 'append'  , 'value' => false),
  50      array('short' => 'o', 'long' => 'output'  , 'value' => true),
  51      array('short' => 'i', 'long' => 'input'  , 'value' => true),
  52      array('short' => 'f', 'long' => 'format'  , 'value' => true)
  53      );
  54  
  55  // Option values
  56  
  57  protected $options=array(
  58      'map_path' => 'auto.map',
  59      'base_path' => null,
  60      'append' => false,
  61      'output' => 'php://stdout',
  62      'input' => 'php://stdin',
  63      'format' => 'auto'
  64      );
  65  
  66  
  67  
  68  //-----------------------
  69  
  70  protected function processOption($opt,$arg)
  71  {
  72  switch($opt)
  73      {
  74      case 'v':
  75          \Phool\Display::incVerbose();
  76          break;
  77  
  78      case 'q':
  79          \Phool\Display::decVerbose();
  80          break;
  81  
  82      case 'm':
  83          $this->options['map_path']=$arg;
  84          break;
  85  
  86      case 'b':
  87          $this->options['base_path']=$arg;
  88          break;
  89  
  90      case 'a':
  91          $this->options['append']=true;
  92          break;
  93  
  94      case 'o':
  95          $this->options['output']=$arg;
  96          break;
  97  
  98      case 'i':
  99          $this->options['input']=$arg;
 100          break;
 101  
 102      case 'f':
 103          $this->options['format']=$arg;
 104          break;
 105      }
 106  }
 107  
 108  //---
 109  } // End of class
 110  //===========================================================================
 111  } // End of class_exists
 112  //===========================================================================
 113  } // End of namespace
 114  //===========================================================================
 115  ?>


Generated: Thu Jun 4 18:32:29 2015 Cross-referenced by PHPXref 0.7.1