From 7e3a20c14adeb672c3cc9de2bba5bbdc3f44b6d5 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Tue, 6 Nov 2012 21:55:46 -0800 Subject: [PATCH] Added a json interface --- Makefile | 6 +++++- jsoncheck.hs | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 jsoncheck.hs diff --git a/Makefile b/Makefile index a0d8d79..ccec4b1 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,14 @@ -all: shellcheck .tests +all: shellcheck jsoncheck .tests : Done shellcheck: regardless : Conditionally compiling shellcheck ghc --make shellcheck +jsoncheck: regardless + : Conditionally compiling shellcheck + ghc --make jsoncheck + .tests: *.hs */*.hs : Running unit tests ./test/runQuack && touch .tests diff --git a/jsoncheck.hs b/jsoncheck.hs new file mode 100644 index 0000000..823683c --- /dev/null +++ b/jsoncheck.hs @@ -0,0 +1,15 @@ +import ShellCheck.Simple +import Text.JSON + +instance JSON ShellCheckComment where + showJSON c = makeObj [ + ("line", showJSON $ scLine c), + ("column", showJSON $ scColumn c), + ("level", showJSON $ scSeverity c), + ("message", showJSON $ scMessage c) + ] + readJSON = undefined + +main = do + script <- getContents + putStrLn $ encodeStrict $ shellCheck script