summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-04-09 14:42:44 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-04-09 14:42:44 +0200
commitdef3b687ee9881d9842c5e916c2a4fb405f88925 (patch)
treea45c9843a76d4346c37f2b92f06b0c76b521f0b5 /core
parentdd5063bd491f26c514e3206a167c2888d6bc3310 (diff)
downloadnextcloud-server-def3b687ee9881d9842c5e916c2a4fb405f88925.tar.gz
nextcloud-server-def3b687ee9881d9842c5e916c2a4fb405f88925.zip
Replace print_r() with pretty json
Diffstat (limited to 'core')
-rw-r--r--core/command/base.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/core/command/base.php b/core/command/base.php
index 7e139636b63..b43022a550c 100644
--- a/core/command/base.php
+++ b/core/command/base.php
@@ -33,22 +33,19 @@ class Base extends Command {
'output',
null,
InputOption::VALUE_OPTIONAL,
- 'Output format (plain, print or json, default is plain)',
+ 'Output format (plain, json or json_pretty, default is plain)',
'plain'
)
;
}
protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items) {
- $outputFormat = $input->getOption('output');
- switch ($outputFormat) {
+ switch ($input->getOption('output')) {
case 'json':
- case 'print':
- if ($outputFormat === 'json') {
- $output->writeln(json_encode($items));
- } else {
- print_r($items);
- }
+ $output->writeln(json_encode($items));
+ break;
+ case 'json_pretty':
+ $output->writeln(json_encode($items, JSON_PRETTY_PRINT));
break;
default:
foreach ($items as $key => $item) {