Documented --json for diff command (#2736)

This commit is contained in:
Tufan Barış YILDIRIM
2019-03-31 20:01:44 -07:00
committed by kannappanr
parent 2ad65c0799
commit a1355e50e2
2 changed files with 38 additions and 4 deletions
+3 -3
View File
@@ -32,9 +32,9 @@ const (
differInNone differType = iota // does not differ
differInSize // differs in size
differInTime // differs in time
differInType // only in source
differInFirst // only in target
differInSecond // differs in type, exfile/directory
differInType // differs in type, exfile/directory
differInFirst // only in source (FIRST)
differInSecond // only in target (SECOND)
)
func (d differType) String() string {
+35 -1
View File
@@ -784,7 +784,18 @@ USAGE:
mc diff [FLAGS] FIRST SECOND
FLAGS:
--help, -h show help
--config-folder value, -C value Path to configuration folder. (default: "/root/.mc")
--quiet, -q Disable progress bar display.
--no-color Disable color theme.
--json Enable JSON formatted output.
--debug Enable debug output.
--insecure Disable SSL certificate verification.
--help, -h Show help.
LEGEND:
> - object is only in source.
< - object is only in destination.
! - newer object is in source.
```
*Example: Compare a local directory and a remote object storage.*
@@ -794,6 +805,29 @@ FLAGS:
‘localdir/notes.txt’ and ‘https://play.minio.io:9000/mybucket/notes.txt’ - only in first.
```
### Option [--json]
JSON option enables parseable output in JSON format.
*Example: diff json output.*
```sh
mc diff minio1/diffbucket minio2/diffbucket --json
{"status":"success","first":"","second":"http://127.0.0.1:9001/diffbucket/file1.png","diff":5}
{"status":"success","first":"http://127.0.0.1:9000/diffbucket/file2.png","second":"","diff":4}
{"status":"success","first":"http://127.0.0.1:9000/diffbucket/file3.png","second":"http://127.0.0.1:9001/diffbucket/file3.png","diff":2}
{"status":"success","first":"http://127.0.0.1:9000/diffbucket/file4.png","second":"http://127.0.0.1:9001/diffbucket/file4.png","diff":1}
```
#### Diff values in json output
|Constant| Value | Meaning |
| ---------- | ---------- | -------- |
|differInNone |0|Does not differ|
|differInSize |1|Differs in size|
|differInTime |2|Differs in time|
|differInType |3|Differs in type exfile/directory|
|differInFirst |4|Only in source (FIRST)|
|differInSecond |5|Only in target (SECOND)|
<a name="watch"></a>
### Command `watch` - Watch for files and object storage events.
``watch`` provides a convenient way to watch on various types of event notifications on object