Skip to content

Commit 62535ec

Browse files
committed
updated help for jsonjoin, fixed types, formatting
1 parent 08091e0 commit 62535ec

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

cmds/jsonjoin/jsonjoin.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ EXAMPLES
3939
4040
person.json containes
4141
42-
{"name": "Doe, Jane", "email":"[email protected]", "age": 42}
42+
{ "name": "Doe, Jane", "email":"[email protected]", "age": 42 }
4343
4444
profile.json containes
4545
46-
{"name": "Doe, Jane", "bio": "World renowned geophysist.",
47-
"email": "[email protected]"}
46+
{ "name": "Doe, Jane", "bio": "World renowned geophysist.",
47+
"email": "[email protected]" }
4848
4949
A simple join of person.json with profile.json
5050
@@ -53,21 +53,21 @@ A simple join of person.json with profile.json
5353
would yeild
5454
5555
{
56-
"person": {"name": "Doe, Jane", "email":"[email protected]", "age": 42},
57-
"profile": {"name": "Doe, Jane", "bio": "World renowned geophysist.",
58-
"email": "[email protected]"}
59-
}
56+
"person": { "name": "Doe, Jane", "email":"[email protected]", "age": 42},
57+
"profile": { "name": "Doe, Jane", "bio": "World renowned geophysist.",
58+
"email": "[email protected]" }
59+
}
6060
61-
You can modify this behavor with -add or -merge. Both options are
62-
order dependant (i.e. not guaranteed to be associative, A add B does
63-
not necessarily equal B add A).
61+
You can modify this behavor with -update or -overwrite. Both options are
62+
order dependant (e.g. not associative, A update B does
63+
not necessarily equal B update A).
6464
6565
+ -update will add unique key/values from the second object to the first object
6666
+ -overwrite replace key/values in first object one with second objects'
6767
6868
Running
6969
70-
%s -update person.json profile.json
70+
%s -update person.json profile.json
7171
7272
would yield
7373
@@ -76,22 +76,22 @@ would yield
7676
7777
Running
7878
79-
%s -update profile.json person.json
79+
%s -update profile.json person.json
8080
8181
would yield
8282
83-
{ "name": "Doe, Jane", "age": 42,
84-
"bio": "World renowned geophysist.",
85-
"email": "[email protected]" }
83+
{ "name": "Doe, Jane", "age": 42,
84+
"bio": "World renowned geophysist.",
85+
"email": "[email protected]" }
8686
8787
Running
8888
89-
%s -overwrite person.json profile.json
89+
%s -overwrite person.json profile.json
9090
9191
would yield
9292
93-
{ "name": "Doe, Jane", "email":"[email protected]", "age": 42,
94-
"bio": "World renowned geophysist." }
93+
{ "name": "Doe, Jane", "email":"[email protected]", "age": 42,
94+
"bio": "World renowned geophysist." }
9595
`
9696

9797
// Basic Options

docs/jsonjoin.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# USAGE
23

34
## jsonjoin [OPTIONS] JSON_FILE_1 JSON_FILE_2
@@ -28,14 +29,14 @@ the options chosen.
2829
person.json containes
2930

3031
```json
31-
{"name": "Doe, Jane", "email":"[email protected]", "age": 42}
32+
{ "name": "Doe, Jane", "email":"[email protected]", "age": 42 }
3233
```
3334

3435
profile.json containes
3536

3637
```json
37-
{"name": "Doe, Jane", "bio": "World renowned geophysist.",
38-
"email": "[email protected]"}
38+
{ "name": "Doe, Jane", "bio": "World renowned geophysist.",
39+
"email": "[email protected]" }
3940
```
4041

4142
A simple join of person.json with profile.json
@@ -48,23 +49,23 @@ would yeild
4849

4950
```json
5051
{
51-
"person": {"name": "Doe, Jane", "email":"[email protected]", "age": 42},
52-
"profile": {"name": "Doe, Jane", "bio": "World renowned geophysist.",
53-
"email": "[email protected]"}
54-
}
52+
"person": { "name": "Doe, Jane", "email":"[email protected]", "age": 42},
53+
"profile": { "name": "Doe, Jane", "bio": "World renowned geophysist.",
54+
"email": "[email protected]" }
55+
}
5556
```
5657

57-
You can modify this behavor with -add or -merge. Both options are
58-
order dependant (i.e. not guaranteed to be associative, A add B does
59-
not necessarily equal B add A).
58+
You can modify this behavor with -update or -overwrite. Both options are
59+
order dependant (e.g. not associative, A update B does
60+
not necessarily equal B update A).
6061

6162
+ -update will add unique key/values from the second object to the first object
6263
+ -overwrite replace key/values in first object one with second objects'
6364

6465
Running
6566

6667
```shell
67-
jsonjoin -update person.json profile.json
68+
jsonjoin -update person.json profile.json
6869
```
6970

7071
would yield
@@ -77,29 +78,28 @@ would yield
7778
Running
7879

7980
```shell
80-
jsonjoin -update profile.json person.json
81+
jsonjoin -update profile.json person.json
8182
```
8283

8384
would yield
8485

8586
```json
86-
{ "name": "Doe, Jane", "age": 42,
87-
"bio": "World renowned geophysist.",
88-
"email": "[email protected]" }
87+
{ "name": "Doe, Jane", "age": 42,
88+
"bio": "World renowned geophysist.",
89+
"email": "[email protected]" }
8990
```
9091

9192
Running
9293

9394
```shell
94-
jsonjoin -overwrite person.json profile.json
95+
jsonjoin -overwrite person.json profile.json
9596
```
9697

9798
would yield
9899

99100
```json
100-
{ "name": "Doe, Jane", "email":"[email protected]", "age": 42,
101-
"bio": "World renowned geophysist." }
101+
{ "name": "Doe, Jane", "email":"[email protected]", "age": 42,
102+
"bio": "World renowned geophysist." }
102103
```
103104

104-
105105
jsonjoin v0.0.12

0 commit comments

Comments
 (0)