From ef68125b3bee2b95b54598d65a97ceb3b04b16d2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 13 Nov 2012 12:30:17 +0100 Subject: [PATCH] Fix config listing --- src/Composer/Command/ConfigCommand.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index f997dc29e..e644e2033 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -267,25 +267,30 @@ EOT */ protected function listConfiguration(array $contents, OutputInterface $output, $k = null) { + $origK = $k; foreach ($contents as $key => $value) { if ($k === null && !in_array($key, array('config', 'repositories'))) { continue; } - if (is_array($value)) { + if (is_array($value) && !is_numeric(key($value))) { $k .= preg_replace('{^config\.}', '', $key . '.'); $this->listConfiguration($value, $output, $k); - if (substr_count($k,'.') > 1) { - $k = str_split($k,strrpos($k,'.',-2)); + if (substr_count($k, '.') > 1) { + $k = str_split($k, strrpos($k, '.', -2)); $k = $k[0] . '.'; } else { - $k = null; + $k = $origK; } continue; } + if (is_array($value)) { + $value = '['.implode(', ', $value).']'; + } + $output->writeln('[' . $k . $key . '] ' . $value . ''); } }