/** * Generates a command line synopsis for the options and arguments. * * This method generates a synopsis string that lists the options and * parameters available, indicating their usage. If $optionsFilter is * submitted, only the options named in this array (short or long variant) * will be included in the synopsis. * * @param array(string) $optionsFilter * @return string */ public function generateSynopsis(array $optionFilter = null) { $usedOptions = array('short' => array(), 'long' => array()); $allowsArgs = true; $synopsis = '$ ' . (isset($argv) && sizeof($argv) > 0 ? $argv[0] : $_SERVER['argv'][0]) . ' '; foreach ($this->input->getOptions() as $option) { if ($optionFilter === null || in_array($option->short, $optionFilter) || in_array($option->long, $optionFilter)) { $synopsis .= $this->createOptionSynopsis($option, $usedOptions, $allowsArgs); } } if ($this->input->argumentDefinition === null) { // Old handling $synopsis .= " [[--] <args>]"; } else { $synopsis .= "[--] " . $this->createArgumentsSynopsis(); } return $synopsis; }
try { $input->process(); } catch ( ezcConsoleOptionException $e ) { die( $e->getMessage() ); } // Show help // --------------------------------------------------------------------------- if ( $helpOption->value === true ) { echo $input->getSynopsis() . "\n"; foreach ( $input->getOptions() as $option ) { echo " -{$option->short}, --{$option->long}\t {$option->shorthelp}\n"; } die(); } // Generate test file // --------------------------------------------------------------------------- $generator = new ezpGenerateTestCaseFromClass( $sourceFileOption->value, $destinationFileOption->value ); $generator->generate(); $testCount = count( $generator->methods ); $out->outputText( "Generated " ); $out->outputText( $testCount, 'count' );