summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-04-30 15:42:18 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-07-07 11:18:24 +0200
commit6ed8ba0ce9f1d4ac68d6a2e53f4e0845ef8abcc5 (patch)
tree72551ca7a5855a577410c4127960d547886a0367 /core
parent6d4cb1b480f6158ab90feb997e36335b250544bb (diff)
downloadnextcloud-server-6ed8ba0ce9f1d4ac68d6a2e53f4e0845ef8abcc5.tar.gz
nextcloud-server-6ed8ba0ce9f1d4ac68d6a2e53f4e0845ef8abcc5.zip
Fix nested array lists
Diffstat (limited to 'core')
-rw-r--r--core/command/base.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/core/command/base.php b/core/command/base.php
index f84dcb1aeaf..f36e00b6dbd 100644
--- a/core/command/base.php
+++ b/core/command/base.php
@@ -44,7 +44,7 @@ class Base extends Command {
* @param OutputInterface $output
* @param array $items
*/
- protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items) {
+ protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = ' - ') {
switch ($input->getOption('output')) {
case 'json':
$output->writeln(json_encode($items));
@@ -54,15 +54,20 @@ class Base extends Command {
break;
default:
foreach ($items as $key => $item) {
+ if (is_array($item)) {
+ $output->writeln($prefix . $key . ':');
+ $this->writeArrayInOutputFormat($input, $output, $item, ' ' . $prefix);
+ continue;
+ }
if (!is_int($key)) {
$value = $this->valueToString($item);
if (!is_null($value)) {
- $output->writeln(' - ' . $key . ': ' . $value);
+ $output->writeln($prefix . $key . ': ' . $value);
} else {
- $output->writeln(' - ' . $key);
+ $output->writeln($prefix . $key);
}
} else {
- $output->writeln(' - ' . $this->valueToString($item));
+ $output->writeln($prefix . $this->valueToString($item));
}
}
break;