From a1355e50e2e8984d645cc7745230c42b27396341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tufan=20Bar=C4=B1=C5=9F=20YILDIRIM?= Date: Mon, 1 Apr 2019 06:01:44 +0300 Subject: [PATCH] Documented --json for diff command (#2736) --- cmd/difference.go | 6 ++--- docs/minio-client-complete-guide.md | 36 ++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/cmd/difference.go b/cmd/difference.go index 699b088d..74e2fd0a 100644 --- a/cmd/difference.go +++ b/cmd/difference.go @@ -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 { diff --git a/docs/minio-client-complete-guide.md b/docs/minio-client-complete-guide.md index 15acf713..dc08d64f 100644 --- a/docs/minio-client-complete-guide.md +++ b/docs/minio-client-complete-guide.md @@ -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)| + ### Command `watch` - Watch for files and object storage events. ``watch`` provides a convenient way to watch on various types of event notifications on object