Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix config listing

  • Loading branch information...
commit ef68125b3bee2b95b54598d65a97ceb3b04b16d2 1 parent 75da832
@Seldaek Seldaek authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/Composer/Command/ConfigCommand.php
View
13 src/Composer/Command/ConfigCommand.php
@@ -267,25 +267,30 @@ function ($vals) {
*/
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('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.