Fix options alignment in help

master
Julien Rosset 6 years ago
parent 44e008fdc7
commit 382b554be6

@ -473,7 +473,8 @@ class CommandLine {
} }
} }
catch (ReflectionException $e) { catch (ReflectionException $e) {
$type = /** @lang text */'<inconnu>'; $type = /** @lang text */
'<inconnu>';
} }
throw new InvalidArgumentException('L\'argument n\'est pas d\'un type géré : ' . $type); throw new InvalidArgumentException('L\'argument n\'est pas d\'un type géré : ' . $type);
@ -723,13 +724,17 @@ class CommandLine {
STR_PAD_RIGHT STR_PAD_RIGHT
); );
$entries[] = self::TAB . implode(self::TAB, array( $entries[] = self::TAB . implode(
self::TAB,
array(
$label, $label,
$occur, $occur,
$valueDescription, $valueDescription,
preg_replace( preg_replace(
/** @lang RegExp */ '@\r?\n@', '@\r?\n@',
'$0' . self::TAB . implode(self::TAB, array( '$0' . self::TAB . implode(
self::TAB,
array(
str_pad('', $pads->name, ' '), str_pad('', $pads->name, ' '),
str_pad('', $pads->occurMin + 4 + $pads->occurMax, ' '), str_pad('', $pads->occurMin + 4 + $pads->occurMax, ' '),
str_pad('', $pads->valueDescription, ' '), str_pad('', $pads->valueDescription, ' '),
@ -798,12 +803,16 @@ class CommandLine {
STR_PAD_RIGHT STR_PAD_RIGHT
); );
$entries[] = self::TAB . self::TAB . implode(self::TAB, array( $entries[] = self::TAB . implode(
self::TAB,
array(
$label, $label,
$valueDescription, $valueDescription,
preg_replace( preg_replace(
/** @lang RegExp */ '@\r?\n@', '@\r?\n@',
'$0' . self::TAB . self::TAB . implode(self::TAB, array( '$0' . self::TAB . self::TAB . implode(
self::TAB,
array(
str_pad('', $pads->tagShort + 1 + $pads->tagLong + 2, ' '), str_pad('', $pads->tagShort + 1 + $pads->tagLong + 2, ' '),
str_pad('', $pads->valueDescription, ' '), str_pad('', $pads->valueDescription, ' '),
'', '',
@ -854,8 +863,9 @@ class CommandLine {
return $out; return $out;
} }
if(($arg = OptionAbstract::containsOption($argv)) !== false) if (($arg = OptionAbstract::containsOption($argv)) !== false) {
throw new IncorrectParse('Option inconnue : ' . $arg); throw new IncorrectParse('Option inconnue : ' . $arg);
}
$values = array_values($this->getValues()); $values = array_values($this->getValues());
/** /**
@ -881,7 +891,7 @@ class CommandLine {
} }
if (count($argv)) { if (count($argv)) {
throw new TooMuchValues('Trop de paramètres : '.count($argv).' / '.$nb_args); throw new TooMuchValues('Trop de paramètres : ' . count($argv) . ' / ' . $nb_args);
} }
// Valeurs par défaut // Valeurs par défaut

Loading…
Cancel
Save