commit a120cea94ed9df5a2dc6ef84c82f0084d1afc9db
parent 45ed5ba5a7ccbef0d7f6ad5630206340809bfb93
Author: Remy Noulin <loader2x@gmail.com>
Date: Sun, 20 May 2018 10:30:44 +0200
prettify json files
package.yml | 16 ++++++++++++++++
pretty.c | 27 +++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
Diffstat:
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/package.yml b/package.yml
@@ -0,0 +1,16 @@
+---
+ name: pretty
+ version: 0.0.1
+ description: "prettify json or yml files by printing an indented json"
+ bin: ./pretty.c
+ repository:
+ type: git
+ url: git+https://github.com/RemyNoulin/pretty.git
+ keywords:
+ - utility
+ - command
+ author: Remy Noulin
+ license: MIT
+ bugs:
+ url: https://github.com/RemyNoulin/pretty/issues
+ homepage: https://github.com/RemyNoulin/pretty#readme
diff --git a/pretty.c b/pretty.c
@@ -0,0 +1,27 @@
+#! /usr/bin/env sheepy
+
+#include "libsheepyObject.h"
+
+int argc; char **argv;
+
+int main(int ARGC, char** ARGV) {
+
+ argc = ARGC; argv = ARGV;
+
+ if (argc < 2) {
+ puts(BLD RED "File name missing" RST);
+ XFAILURE
+ }
+
+ initLibsheepy(argv[0]);
+
+ createSmallJson(j);
+ readFileG(&j, argv[1]);
+
+ char *s = stringifyG(&j, 2);
+
+ puts(s);
+ free(s);
+
+ freeG(&j);
+}