Skip to content

Commit

Permalink
Use colorjson to indent json properly in cp (#3030)
Browse files Browse the repository at this point in the history
Additionally also do not initialize progress bar in json
or quiet mode in mirror.

Fixes #3029
Fixes #3017
  • Loading branch information
harshavardhana authored and kannappanr committed Jan 3, 2020
1 parent 9663319 commit 6d1a414
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/cp-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package cmd
import (
"bufio"
"context"
"encoding/json"
"errors"
"fmt"
"io"
Expand All @@ -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"
)
Expand Down
8 changes: 8 additions & 0 deletions cmd/difference.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions cmd/mirror-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6d1a414

Please sign in to comment.