Skip to content

Commit 5a1f518

Browse files
committed
v.0.1.0
1 parent de61405 commit 5a1f518

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/json_diff/core.clj

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
(ns json-diff.core
2+
(:require [clojure.data.json :as json]
3+
;; [clojure.core.async :as async]
4+
[lambdaisland.deep-diff2 :as ddiff]
5+
[clojure.java.io :as io])
26
(:gen-class))
37

8+
49
(defn diff
510
"prints diff between JSON files"
6-
[file1 file2])
11+
[fn1 fn2]
12+
(with-open [file1 (io/reader fn1)
13+
file2 (io/reader fn2)]
14+
(let [json1 (json/read file1)
15+
json2 (json/read file2)]
16+
(ddiff/pretty-print (ddiff/diff json1 json2)))))
717

818
(defn -main
919
"Main function"
1020
[& args]
1121
(if (> 2 (count args))
1222
(println "Not enough parameters!")
13-
(let [file1 (first args)
14-
file2 (second args)]
15-
(diff file1 file2))))
23+
(let [fn1 (first args)
24+
fn2 (second args)]
25+
(diff fn1 fn2))))

0 commit comments

Comments
 (0)