/** @return CommandLine */ private function loadOptions() { $cmd = new CommandLine(<<<XX Name: DB Entities Generator Description: Generate database entities for use with Nette Database. Usage: index.php [options] Options: -s <path> SQL file with schema to be parsed to entities. -n <namespace> What namespace to put generated entities into. Will be used also as destination directory. (default: DbEntity) -d <database name> Used as part of namespace and directory for entities. [optional] (default: none) -a Generate also absolute constants. This will generate: const __COLUMN_NAME = 'table.column_name'; Constant name is prefixed with (__) two underscores. [optional] (default: true) -e Enquote table and column names. This will generate: const __COLUMN_NAME = '`table`.`column_name`'; [optional] (default: false) -f Remove destination directory if exists - use force. [optional] (default: true) -h | --help This help. XX , array('-s' => array(CommandLine::REALPATH => TRUE), '-n' => array(CommandLine::VALUE => 'DbEntity'), '-d' => array(CommandLine::OPTIONAL => TRUE, CommandLine::VALUE => ''), '-a' => array(CommandLine::OPTIONAL => TRUE, CommandLine::VALUE => TRUE), '-e' => array(CommandLine::OPTIONAL => TRUE, CommandLine::VALUE => FALSE), '-f' => array(CommandLine::OPTIONAL => TRUE, CommandLine::VALUE => TRUE))); $this->options = $cmd->parse(); return $cmd; }
/** @return CommandLine */ private function loadOptions() { echo <<<'XX' _____ ___ ___ _____ ___ ___ |_ _/ __)( __/_ _/ __)| _ ) |_| \___ /___) |_| \___ |_|_\ v1.3.2 XX; $cmd = new CommandLine(<<<XX Usage: tester.php [options] [<test file> | <directory>]... Options: -p <path> Specify PHP interpreter to run (default: php-cgi). -c <path> Look for php.ini file (or look in directory) <path>. -l | --log <path> Write log to file <path>. -d <key=value>... Define INI entry 'key' with value 'val'. -s Show information about skipped tests. --stop-on-fail Stop execution upon the first failure. -j <num> Run <num> jobs in parallel (default: 8). -o <console|tap|none> Specify output format. -w | --watch <path> Watch directory. -i | --info Show tests environment info and exit. --setup <path> Script for runner setup. --colors [1|0] Enable or disable colors. --coverage <path> Generate code coverage report to file. --coverage-src <path> Path to source code. -h | --help This help. XX , array('-c' => array(CommandLine::REALPATH => TRUE), '--watch' => array(CommandLine::REPEATABLE => TRUE, CommandLine::REALPATH => TRUE), '--setup' => array(CommandLine::REALPATH => TRUE), 'paths' => array(CommandLine::REPEATABLE => TRUE, CommandLine::VALUE => getcwd()), '--debug' => array(), '--coverage-src' => array(CommandLine::REALPATH => TRUE))); if (isset($_SERVER['argv'])) { if ($tmp = array_search('-log', $_SERVER['argv'])) { $_SERVER['argv'][$tmp] = '--log'; } if ($tmp = array_search('--tap', $_SERVER['argv'])) { unset($_SERVER['argv'][$tmp]); $_SERVER['argv'] = array_merge($_SERVER['argv'], array('-o', 'tap')); } } $this->options = $cmd->parse(); return $cmd; }
|_| \\___ /___) |_| \\___ |_|_\\ v1.2.0 XX; $cmd = new Cmd(<<<XX Usage: tester.php [options] [<test file> | <directory>]... Options: -p <path> Specify PHP executable to run (default: php-cgi). -c <path> Look for php.ini file (or look in directory) <path>. -l | --log <path> Write log to file <path>. -d <key=value>... Define INI entry 'key' with value 'val'. -s Show information about skipped tests. --stop-on-fail Stop execution upon the first failure. --tap Generate Test Anything Protocol. -j <num> Run <num> jobs in parallel (default: 33). -w | --watch <path> Watch directory. -i | --info Show tests environment info and exit. --setup <path> Script for runner setup. --colors [1|0] Enable or disable colors. --coverage <path> Generate code coverage report to file. --coverage-src <path> Path to source code. -h | --help This help. XX , array('-c' => array(Cmd::REALPATH => TRUE), '--watch' => array(Cmd::REPEATABLE => TRUE, Cmd::REALPATH => TRUE), '--setup' => array(Cmd::REALPATH => TRUE), 'paths' => array(Cmd::REPEATABLE => TRUE, Cmd::VALUE => getcwd()), '--debug' => array(), '--coverage-src' => array(Cmd::REALPATH => TRUE))); if (isset($_SERVER['argv']) && ($tmp = array_search('-log', $_SERVER['argv']))) { $_SERVER['argv'][$tmp] = '--log'; } $options = $cmd->parse();
<?php /** * Code coverage HTML report generator. * * This file is part of the Nette Tester. */ require __DIR__ . '/CodeCoverage/ReportGenerator.php'; require __DIR__ . '/Runner/CommandLine.php'; use Tester\Runner\CommandLine as Cmd; $cmd = new Cmd("\nCode coverage HTML report generator\n-----------------------------------\n\nUsage:\n\tphp coverage-report.php [options]\n\nOptions:\n\t-c <path> coverage.dat file (default: coverage.dat)\n\t-s <path> directory with source code\n\t-o <path> output file (default: coverage.html)\n\t-t <title> title of generated documentation\n\t-h | --help this help\n\n", array('-c' => array(Cmd::REALPATH), '-s' => array(Cmd::REALPATH))); $options = $cmd->parse(); if ($cmd->isEmpty()) { $cmd->help(); } elseif ($options['--help']) { $cmd->help(); exit; } try { $generator = new ReportGenerator($options['-c'], $options['-s'], $options['-t']); if ($options['-o'] === '-') { $generator->render(); } else { echo "Generating report to {$options['-o']}\n"; $generator->render($options['-o']); echo "Done.\n"; } } catch (Exception $e) { echo "Error: {$e->getMessage()}\n"; die(254); }