dwpage: output meta data as JSON
json shows the same nested data but is easier to process by other tools
This commit is contained in:
parent
3fe0184449
commit
8d670f35f5
|
@ -139,7 +139,6 @@ class PageCLI extends CLI {
|
||||||
false,
|
false,
|
||||||
'getmeta'
|
'getmeta'
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -185,10 +184,9 @@ class PageCLI extends CLI {
|
||||||
case 'getmeta':
|
case 'getmeta':
|
||||||
$wiki_id = array_shift($args);
|
$wiki_id = array_shift($args);
|
||||||
$key = trim(array_shift($args));
|
$key = trim(array_shift($args));
|
||||||
$meta=print_r(p_get_metadata($wiki_id, $key), true);
|
$meta = p_get_metadata($wiki_id, $key, METADATA_RENDER_UNLIMITED);
|
||||||
print($meta);
|
echo trim(json_encode($meta, JSON_PRETTY_PRINT));
|
||||||
if (strcmp(substr($meta, -1), "\n"))
|
echo "\n";
|
||||||
print("\n");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
echo $options->help();
|
echo $options->help();
|
||||||
|
|
Loading…
Reference in New Issue