diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-02-29 21:14:48 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-02-29 21:14:48 +0200 |
commit | 1eab650c0daf312782548f4332f2998da5f0a954 (patch) | |
tree | 00a117b8dd3d8d0becf5bc395aa856be85146d44 | |
parent | 1bc5029024cadbbcd5d3f71c46bde391db454095 (diff) | |
download | extrautils-1eab650c0daf312782548f4332f2998da5f0a954.tar.gz |
Add prettyml, prettyson
-rw-r--r-- | NEWS | 5 | ||||
-rwxr-xr-x | prettyml | 11 | ||||
-rwxr-xr-x | prettyson | 9 |
3 files changed, 23 insertions, 2 deletions
@@ -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) |