Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c1c9371

Browse files
Update README and LICENSE
1 parent 56a4ed5 commit c1c9371

File tree

7 files changed

+44
-13
lines changed

7 files changed

+44
-13
lines changed

‎Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "json_diff"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["ksceriath"]
55
edition = "2018"
66
license = "Unlicense"

‎README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
# json-diff
22

3-
A small command line utility to compare two jsons.
3+
json-diff is a command line utility to compare two jsons.
44

5-
Usage Example:
5+
Input can be fed as inline strings or through files.
6+
For readability, output is neatly differentiated into three categories: keys with different values, and keys not present in either of the objects.
7+
Only missing or unequal keys are printed in output to reduce the verbosity.
68

7-
json_diff f source1.json source2.json
9+
## Screenshot of diff results
810

9-
json_diff d '{...}' '{...}'
11+
[![A screenshot of a sample diff with json_diff](https://github.com/ksceriath/json-diff/blob/master/Screenshot.png)](https://github.com/ksceriath/json-diff/blob/master/Screenshot.png)
1012

11-
Option:
13+
Usage Example:
1214

13-
f : read input from json files
15+
`$ json_diff f source1.json source2.json`
16+
`$ json_diff d '{...}' '{...}'`
17+
18+
Option:
1419

20+
f : read input from json files
1521
d : read input from command line
1622

1723

‎Screenshot.png

2.37 MB
Loading[フレーム]

‎UNLICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org/>

‎src/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::fmt;
2+
use colored::*;
23

34
#[derive(Debug)]
45
pub enum Message {
@@ -31,6 +32,6 @@ impl fmt::Display for Message {
3132
Message::Mismatch => "Mismatched",
3233
};
3334

34-
write!(f, "{}", message)
35+
write!(f, "{}", message.bold())
3536
}
3637
}

‎src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ fn display_output(result: Mismatch) {
9393
let stdout = io::stdout();
9494
let mut handle = io::BufWriter::new(stdout.lock());
9595
if no_mismatch == result {
96-
writeln!(handle, "{}", Message::NoMismatch).unwrap();
96+
writeln!(handle, "\n{}", Message::NoMismatch).unwrap();
9797
} else {
9898
match result.keys_in_both {
9999
KeyNode::Node(_) => {
100100
let mut keys = Vec::new();
101101
result.keys_in_both.absolute_keys(&mut keys, None);
102-
writeln!(handle, "{}:", Message::Mismatch).unwrap();
102+
writeln!(handle, "\n{}:", Message::Mismatch).unwrap();
103103
for key in keys {
104104
writeln!(handle, "{}", key).unwrap();
105105
}
@@ -111,7 +111,7 @@ fn display_output(result: Mismatch) {
111111
KeyNode::Node(_) => {
112112
let mut keys = Vec::new();
113113
result.left_only_keys.absolute_keys(&mut keys, None);
114-
writeln!(handle, "{}:", Message::LeftExtra).unwrap();
114+
writeln!(handle, "\n{}:", Message::LeftExtra).unwrap();
115115
for key in keys {
116116
writeln!(handle, "{}", key.red().bold()).unwrap();
117117
}
@@ -123,7 +123,7 @@ fn display_output(result: Mismatch) {
123123
KeyNode::Node(_) => {
124124
let mut keys = Vec::new();
125125
result.right_only_keys.absolute_keys(&mut keys, None);
126-
writeln!(handle, "{}:", Message::RightExtra).unwrap();
126+
writeln!(handle, "\n{}:", Message::RightExtra).unwrap();
127127
for key in keys {
128128
writeln!(handle, "{}", key.green().bold()).unwrap();
129129
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /