summaryrefslogtreecommitdiff
path: root/prettyson
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-03-12 08:18:19 +0200
committerLars Wirzenius <liw@liw.fi>2021-03-12 08:24:06 +0200
commitcd4fd5d237c6decac7f7b4b2442654c276f53035 (patch)
treed42293dd58449cc093d478c32f9215bfc332ec2d /prettyson
parentcedecd2ec55a8317873d96ba69b4e9f6126b75c5 (diff)
downloadextrautils-cd4fd5d237c6decac7f7b4b2442654c276f53035.tar.gz
refactor(prettyson): reformat, port to Pytthon 3
Diffstat (limited to 'prettyson')
-rwxr-xr-xprettyson11
1 files changed, 7 insertions, 4 deletions
diff --git a/prettyson b/prettyson
index 0a327ad..e2cb0df 100755
--- a/prettyson
+++ b/prettyson
@@ -1,6 +1,8 @@
-#!/usr/bin/python
+#!/usr/bin/python3
+
+import json
+import sys
-import sys, json
def inputs(args):
if args:
@@ -8,10 +10,11 @@ def inputs(args):
with open(filename) as f:
yield filename, f
else:
- yield '-', sys.stdin
+ yield "-", sys.stdin
+
objs = []
for filename, f in inputs(sys.argv[1:]):
objs.append(json.load(f))
json.dump(objs, sys.stdout, indent=4)
-sys.stdout.write('\n')
+sys.stdout.write("\n")