File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
1
# json-diff
2
2
3
- A console program to produce colorized ** structural diff** of two JSON files
3
+ A console program to produce ** structural diff** of two JSON files
4
4
5
5
## Usage
6
6
7
- $ java -jar json-diff.jar file1.json file2.json
7
+ $ java -jar json-diff.jar [-m {visual|patch}] file1.json file2.json
8
+
9
+ ` -m ` or ` --mode ` lets you choose output format.
10
+
11
+ ` visual ` prints ** all** JSON, marking difference in-place. It's made with [ deep-diff2] ( https://github.com/lambdaisland/deep-diff2 ) .
12
+
13
+ ` patch ` prints the minimal necessary changes needed to make file2 from file1. It's made with [ editscript] ( https://github.com/juji-io/editscript ) .
8
14
9
15
## License
10
16
Original file line number Diff line number Diff line change 1
1
(ns json-diff.core
2
- (:require [clojure.java.io :as io]
2
+ (:require [clojure.string :as str]
3
+ [clojure.java.io :as io]
3
4
[clojure.data.json :as json]
4
5
[clojure.core.async :refer [>! <!! go chan]]
5
6
[clojure.tools.cli :refer [parse-opts]]
51
52
errors :errors
52
53
{:keys [mode]} :options } (parse-opts args cli-options)]
53
54
(cond
54
- errors (print-error-exit (str errors) 1 )
55
+ errors (print-error-exit (str/join " \n " errors) 1 )
55
56
(not= 2 (count files)) (print-error-exit " you need to pass two JSON files!" 1 )
56
57
(= :visual mode) (apply process diff files)
57
58
(= :patch mode) (apply process patch files))))
You can’t perform that action at this time.
0 commit comments