git.shiar.nl
/
wormy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
parse-wormedit: json format option
[wormy.git]
/
parse-wormedit
diff --git
a/parse-wormedit
b/parse-wormedit
index cf1798d6a25e6cb787b9836577add8782ec93aed..aa220513657bfdaf49507b9311e97ea627334025 100755
(executable)
--- a/
parse-wormedit
+++ b/
parse-wormedit
@@
-54,7
+54,7
@@
else {
if ($opt{output}) {{
# derive format from file extension
if ($opt{output}) {{
# derive format from file extension
- if ($opt{output} =~ /\.(yaml|txt)$/) {
+ if ($opt{output} =~ /\.(yaml|
json|
txt)$/) {
$opt{format} //= $1
}
else {
$opt{format} //= $1
}
else {
@@
-70,6
+70,10
@@
if ($opt{output}) {{
# output with user-preferred formatting
given ($opt{format}) {
# output with user-preferred formatting
given ($opt{format}) {
+when ('json') {
+ require JSON;
+ say JSON->new->encode($data);
+}
when ('yaml') {
# full data in yaml (human-readable) formatting
require YAML;
when ('yaml') {
# full data in yaml (human-readable) formatting
require YAML;
@@
-201,6
+205,10
@@
Plain text summary of levelpack contents.
All parsed data in YAML syntax.
All parsed data in YAML syntax.
+=item json
+
+Parsed data in JSON syntax.
+
=item pnm, png, bmp, ...
Image drawing of rendered levels.
=item pnm, png, bmp, ...
Image drawing of rendered levels.