/** * @throws \alphayax\utils\cli\exception\MissingArgException */ public function testException() { $this->setExpectedException(\alphayax\utils\cli\exception\MissingArgException::class); $opt = new \alphayax\utils\cli\GetOpt(); $opt->setDescription('This script is a tiny example to show library features'); $opt->addLongOpt('dry-run', 'Dry Run mode', true, true); $opt->addShortOpt('d', 'Debug mode'); $opt->addOpt('v', 'verbose', "Verbose Mode"); $opt->parse(); }
<?php require_once '../vendor/autoload.php'; $Opt = new \alphayax\utils\cli\GetOpt(); $Opt->setDescription('This script is a tiny example to show library features'); $Opt->addLongOpt('file', 'Specify the file name', true); $Opt->addLongOpt('dry-run', 'Dry Run mode'); $Opt->addShortOpt('n', 'Number of lines', true, true); $Opt->addShortOpt('d', 'Debug mode'); $Opt->addOpt('v', 'verbose', "Verbose Mode"); $Opt->parse(); print_r($Opt);