From 8d670f35f59ace4a7e3d54b75cb3800c4000d619 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 16 Feb 2021 21:37:20 +0100 Subject: [PATCH] dwpage: output meta data as JSON json shows the same nested data but is easier to process by other tools --- bin/dwpage.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/dwpage.php b/bin/dwpage.php index 3973ec222..a640fa783 100755 --- a/bin/dwpage.php +++ b/bin/dwpage.php @@ -139,7 +139,6 @@ class PageCLI extends CLI { false, 'getmeta' ); - } /** @@ -185,10 +184,9 @@ class PageCLI extends CLI { case 'getmeta': $wiki_id = array_shift($args); $key = trim(array_shift($args)); - $meta=print_r(p_get_metadata($wiki_id, $key), true); - print($meta); - if (strcmp(substr($meta, -1), "\n")) - print("\n"); + $meta = p_get_metadata($wiki_id, $key, METADATA_RENDER_UNLIMITED); + echo trim(json_encode($meta, JSON_PRETTY_PRINT)); + echo "\n"; break; default: echo $options->help();