Merge pull request #1389 from abperiasamy/share-color-fix
fix coloring bug in json message
This commit is contained in:
@@ -23,7 +23,6 @@ import (
|
||||
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/mc/pkg/client"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
"github.com/minio/minio-xl/pkg/probe"
|
||||
)
|
||||
|
||||
@@ -103,18 +102,18 @@ func makeCurlCmd(key string, uploadInfo map[string]string) string {
|
||||
if !isBucketVirtualStyle(URL.Host) {
|
||||
postURL = postURL + uploadInfo["bucket"]
|
||||
}
|
||||
postURL = postURL + " "
|
||||
postURL += " "
|
||||
curlCommand := "curl " + postURL
|
||||
for k, v := range uploadInfo {
|
||||
if k == "key" {
|
||||
key = v
|
||||
continue
|
||||
}
|
||||
curlCommand = curlCommand + fmt.Sprintf("-F %s=%s ", k, v)
|
||||
curlCommand += fmt.Sprintf("-F %s=%s ", k, v)
|
||||
}
|
||||
curlCommand = curlCommand + fmt.Sprintf("-F key=%s ", key) + "-F file=@<FILE> "
|
||||
emphasize := console.Colorize("File", "<FILE>")
|
||||
return strings.Replace(curlCommand, "<FILE>", emphasize, -1)
|
||||
curlCommand += fmt.Sprintf("-F key=%s ", key) // Object name.
|
||||
curlCommand += "-F file=@<FILE>" // File to upload.
|
||||
return curlCommand
|
||||
}
|
||||
|
||||
// save shared URL to disk.
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
@@ -64,9 +65,12 @@ func (s shareMesssage) String() string {
|
||||
if s.ContentType != "" {
|
||||
msg += console.Colorize("Content-type", fmt.Sprintf("Content-Type: %s\n", s.ContentType))
|
||||
}
|
||||
msg += console.Colorize("Share", fmt.Sprintf("Share: %s\n", s.ShareURL))
|
||||
|
||||
return msg // + "\n" // Separate each entry with a new-line.
|
||||
// Highlight <FILE> specially. "share upload" sub-commands uses this identifier.
|
||||
shareURL := strings.Replace(s.ShareURL, "<FILE>", console.Colorize("File", "<FILE>"), 1)
|
||||
msg += console.Colorize("Share", fmt.Sprintf("Share: %s\n", shareURL))
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
// JSON - JSONified message for scripting.
|
||||
|
||||
Reference in New Issue
Block a user