protected function getColumnWidth(array $commands)
{
$width = 0;
foreach ($commands as $command) {
$aliasesString = $this->formatAliases($command->getAliases());
$commandWidth = strlen($command->getName()) + strlen($aliasesString);
$width = $commandWidth > $width ? $commandWidth : $width;
}
// Limit to a maximum.
$terminalWidth = $this->getTerminalWidth();
if ($width / $terminalWidth > 0.4) {
$width = floor($terminalWidth * 0.4);
}
// Start at a minimum.
if ($width < 20) {
$width = 20;
}
// Add the indent.
$width += 2;
// Accommodate tags.
$width += strlen('<info></info>');
return $width;
}