Skip to content

Commit bceb244

Browse files
committed
updated docs, fixed tools.cli error printing
1 parent ca78679 commit bceb244

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
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

src/json_diff/core.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
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]]
@@ -51,7 +52,7 @@
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))))

0 commit comments

Comments
 (0)