Use colorjson to indent json properly in cp (#3030)

Additionally also do not initialize progress bar in json
or quiet mode in mirror.

Fixes #3029
Fixes #3017
This commit is contained in:
Harshavardhana
2020-01-03 12:14:39 -08:00
committed by kannappanr
parent 9663319e9e
commit 6d1a41458b
3 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -19,7 +19,6 @@ package cmd
import (
"bufio"
"context"
"encoding/json"
"errors"
"fmt"
"io"
@@ -30,6 +29,7 @@ import (
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio/pkg/console"
)
+8
View File
@@ -284,6 +284,14 @@ func difference(sourceClnt, targetClnt Client, sourceURL, targetURL string, isMe
err := differenceInternal(sourceClnt, targetClnt, sourceURL, targetURL,
isMetadata, isRecursive, returnSimilar, dirOpt, diffCh)
if err != nil {
// handle this specifically for filesystem related errors.
switch err.ToGoError().(type) {
case BrokenSymlink, TooManyLevelsSymlink, PathNotFound, PathInsufficientPermission:
diffCh <- diffMessage{
Error: err,
}
return
}
errorIf(err, "Unable to list comparison retrying..")
} else {
// Success.
+4 -4
View File
@@ -695,13 +695,13 @@ func newMirrorJob(srcURL, dstURL string, isFake, isRemove, isOverwrite, isWatch,
// we'll define the status to use here,
// do we want the quiet status? or the progressbar
var status = NewProgressStatus(mj.parallel)
if globalQuiet {
status = NewQuietStatus(mj.parallel)
mj.status = NewQuietStatus(mj.parallel)
} else if globalJSON {
status = NewQuietStatus(mj.parallel)
mj.status = NewQuietStatus(mj.parallel)
} else {
mj.status = NewProgressStatus(mj.parallel)
}
mj.status = status
return &mj
}