You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
901 B
PHP
22 lines
901 B
PHP
<?php
|
|
|
|
require_once '../vendor/autoload.php';
|
|
|
|
use CommandLine\Argument\Option\Flag;
|
|
use CommandLine\Argument\Option\Value;
|
|
use CommandLine\Argument\Parser\IntegerParser;
|
|
use CommandLine\Argument\Parser\StringParser;
|
|
use CommandLine\CommandLine;
|
|
|
|
$cmdline = new CommandLine('Test', 'Programme de test', 'php test.php');
|
|
$cmdline->addDefaultArguments();
|
|
$cmdline->addOption(new Flag('array_form', false, 'Sous la forme d\'un tableau ?'."\n".'Ou pas'));
|
|
$cmdline->addOption((new Value('days', 'Nombre jour', new IntegerParser(0, 365)))->setDefault(3));
|
|
$cmdline->addOption((new Value('years', 'Nombre d\'années', new IntegerParser(0)))->setDefault(5));
|
|
$cmdline->addValue((new \CommandLine\Argument\Value\Value('path', 'Chemin sauvegarde images', new StringParser(), true)));
|
|
|
|
$args = $cmdline->parseExplicit(array('--help'));
|
|
$cmdline->treatDefaultArguments($args, false);
|
|
|
|
echo "\n";
|
|
var_dump($args); |