array( 'autoregister_zf' => true, ), )); require_once __DIR__ . '/Hart.php'; // MAIN $opts = new Zend\Console\Getopt([ 'user|u-s' => 'Basic Auth user', 'password|p-s' => 'Basic Auth password', 'f' => 'format output using YouTrack markup', 'version|v' => 'version', 'help|h' => 'help', ]); $printHelp = function () use ($opts) { $message = $opts->getUsageMessage(); $message = str_replace('[ options ]', 'FILE [ options ]' . PHP_EOL, $message); echo APPLICATION_ID . PHP_EOL . PHP_EOL . $message . PHP_EOL . 'Example: hart.phar .htaccess -u tester -p test -f' . PHP_EOL . PHP_EOL; }; try { $opts->parse(); } catch (Exception $e) { echo $e->getMessage(), PHP_EOL, PHP_EOL; $printHelp(); exit; } if ($opts->getOption('h')) { die($opts->getUsageMessage()); } if ($opts->getOption('v')) { die('Version: ' . APPLICATION_ID . PHP_EOL); } if (!($opts->getRemainingArgs())) { $printHelp(); exit; } $file = current($opts->getRemainingArgs()); $test = new Hart(); if ($opts->getOption('f')) { $test->setYouTrackFormat(true); } if (($user = $opts->getOption('u')) && ($password = $opts->getOption('p'))) { $test->setCredentials($user, $password); } $test->run($file); echo PHP_EOL;