From 1eab650c0daf312782548f4332f2998da5f0a954 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 29 Feb 2016 21:14:48 +0200 Subject: Add prettyml, prettyson --- NEWS | 5 +++-- prettyml | 11 +++++++++++ prettyson | 9 +++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 prettyml create mode 100755 prettyson 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) -- cgit v1.2.1