summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-02-29 21:14:48 +0200
committerLars Wirzenius <liw@liw.fi>2016-02-29 21:14:48 +0200
commit1eab650c0daf312782548f4332f2998da5f0a954 (patch)
tree00a117b8dd3d8d0becf5bc395aa856be85146d44
parent1bc5029024cadbbcd5d3f71c46bde391db454095 (diff)
downloadextrautils-1eab650c0daf312782548f4332f2998da5f0a954.tar.gz
Add prettyml, prettyson
-rw-r--r--NEWS5
-rwxr-xr-xprettyml11
-rwxr-xr-xprettyson9
3 files changed, 23 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 1579a4e..f888144 100644
--- a/NEWS
+++ b/NEWS
@@ -6,10 +6,11 @@ package, please yell at me, and I'll start doing that, but for now,
I'll assume I'm the only user.
-Version UNRELEASED
-------------------
+Version 1.20121007+git, not yet released
+----------------------------------------
* `do-until` now displays a try counter when the command fails.
+* Added `prettyson` and `prettyml` scripts.
Version 1.20121007
------------------
diff --git a/prettyml b/prettyml
new file mode 100755
index 0000000..fe9f468
--- /dev/null
+++ b/prettyml
@@ -0,0 +1,11 @@
+#!/usr/bin/python
+
+import sys
+
+import yaml
+
+objs = []
+for filename in sys.argv[1:]:
+ with open(filename) as f:
+ objs.append(yaml.safe_load(f))
+yaml.safe_dump_all(objs, stream=sys.stdout, indent=4, default_flow_style=False)
diff --git a/prettyson b/prettyson
new file mode 100755
index 0000000..367cff8
--- /dev/null
+++ b/prettyson
@@ -0,0 +1,9 @@
+#!/usr/bin/python
+
+import sys, json
+
+objs = []
+for filename in sys.argv[1:]:
+ with open(filename) as f:
+ objs.append(json.load(f))
+json.dump(objs, sys.stdout, indent=4)