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:
committed by
kannappanr
parent
9663319e9e
commit
6d1a41458b
+1
-1
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user