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,22 +724,26 @@ class CommandLine {
STR_PAD_RIGHT STR_PAD_RIGHT
); );
$entries[] = self::TAB . implode(self::TAB, array( $entries[] = self::TAB . implode(
$label, self::TAB,
$occur, array(
$valueDescription, $label,
preg_replace( $occur,
/** @lang RegExp */ '@\r?\n@', $valueDescription,
'$0' . self::TAB . implode(self::TAB, array( preg_replace(
str_pad('', $pads->name, ' '), '@\r?\n@',
str_pad('', $pads->occurMin + 4 + $pads->occurMax, ' '), '$0' . self::TAB . implode(
str_pad('', $pads->valueDescription, ' '), self::TAB,
'', array(
) str_pad('', $pads->name, ' '),
), str_pad('', $pads->occurMin + 4 + $pads->occurMax, ' '),
$value->getDescription() str_pad('', $pads->valueDescription, ' '),
), '',
) )
),
$value->getDescription()
),
)
); );
} }
@ -798,20 +803,24 @@ class CommandLine {
STR_PAD_RIGHT STR_PAD_RIGHT
); );
$entries[] = self::TAB . self::TAB . implode(self::TAB, array( $entries[] = self::TAB . implode(
$label, self::TAB,
$valueDescription, array(
preg_replace( $label,
/** @lang RegExp */ '@\r?\n@', $valueDescription,
'$0' . self::TAB . self::TAB . implode(self::TAB, array( preg_replace(
str_pad('', $pads->tagShort + 1 + $pads->tagLong + 2, ' '), '@\r?\n@',
str_pad('', $pads->valueDescription, ' '), '$0' . self::TAB . self::TAB . implode(
'', self::TAB,
) array(
), str_pad('', $pads->tagShort + 1 + $pads->tagLong + 2, ' '),
$option->getDescription() str_pad('', $pads->valueDescription, ' '),
), '',
) )
),
$option->getDescription()
),
)
); );
} }
@ -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