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 11# json-diff
22
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
44
55## Usage
66
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 ) .
814
915## License
1016
Original file line number Diff line number Diff line change 11(ns json-diff.core
2- (:require [clojure.java.io :as io]
2+ (:require [clojure.string :as str]
3+ [clojure.java.io :as io]
34 [clojure.data.json :as json]
45 [clojure.core.async :refer [>! <!! go chan]]
56 [clojure.tools.cli :refer [parse-opts]]
5152 errors :errors
5253 {:keys [mode]} :options } (parse-opts args cli-options)]
5354 (cond
54- errors (print-error-exit (str errors) 1 )
55+ errors (print-error-exit (str/join " \n " errors) 1 )
5556 (not= 2 (count files)) (print-error-exit " you need to pass two JSON files!" 1 )
5657 (= :visual mode) (apply process diff files)
5758 (= :patch mode) (apply process patch files))))
You can’t perform that action at this time.
0 commit comments