From 8c84df5e74f2f4ae894392d4b9b2840a8b3ffbb5 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 13 Jul 2016 00:56:00 -0700 Subject: [PATCH] server: Change color codes for headings and sub-headings. (#2197) This patch changes the color coding used for headings, sub-headings and values as finalized. --- access-key.go | 8 -------- globals.go | 6 +++--- server-startup-msg.go | 30 +++++++++++++++--------------- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/access-key.go b/access-key.go index 21e212d66..e5741b87e 100644 --- a/access-key.go +++ b/access-key.go @@ -19,7 +19,6 @@ package main import ( "crypto/rand" "encoding/base64" - "fmt" "regexp" ) @@ -29,13 +28,6 @@ type credential struct { SecretAccessKey string `json:"secretKey"` } -// stringer colorized access keys. -func (a credential) String() string { - accessStr := colorMagenta("AccessKey: ") + colorWhite(a.AccessKeyID) - secretStr := colorMagenta("SecretKey: ") + colorWhite(a.SecretAccessKey) - return fmt.Sprint(accessStr + " " + secretStr) -} - const ( minioAccessID = 20 minioSecretID = 40 diff --git a/globals.go b/globals.go index 21fa85b47..2bb0ec59e 100644 --- a/globals.go +++ b/globals.go @@ -55,7 +55,7 @@ var ( // global colors. var ( - colorMagenta = color.New(color.FgMagenta, color.Bold).SprintfFunc() - colorWhite = color.New(color.FgWhite, color.Bold).SprintfFunc() - colorGreen = color.New(color.FgGreen, color.Bold).SprintfFunc() + colorWhite = color.New(color.FgWhite).SprintfFunc() + colorWhiteBold = color.New(color.FgWhite, color.Bold).SprintfFunc() + colorBlue = color.New(color.FgBlue).SprintfFunc() ) diff --git a/server-startup-msg.go b/server-startup-msg.go index 54c549b17..2b6d428c3 100644 --- a/server-startup-msg.go +++ b/server-startup-msg.go @@ -56,13 +56,13 @@ func printServerCommonMsg(endPoints []string) { endPointStr := strings.Join(endPoints, " ") // Colorize the message and print. - console.Println(colorMagenta("\nEndpoint: ") + colorGreen(fmt.Sprintf(getFormatStr(len(endPointStr), 1), endPointStr))) - console.Println(colorMagenta("AccessKey: ") + colorWhite(fmt.Sprintf("%s ", cred.AccessKeyID))) - console.Println(colorMagenta("SecretKey: ") + colorWhite(fmt.Sprintf("%s ", cred.SecretAccessKey))) - console.Println(colorMagenta("Region: ") + colorWhite(fmt.Sprintf(getFormatStr(len(region), 3), region))) + console.Println(colorBlue("\nEndpoint: ") + colorWhiteBold(fmt.Sprintf(getFormatStr(len(endPointStr), 1), endPointStr))) + console.Println(colorBlue("AccessKey: ") + colorWhiteBold(fmt.Sprintf("%s ", cred.AccessKeyID))) + console.Println(colorBlue("SecretKey: ") + colorWhiteBold(fmt.Sprintf("%s ", cred.SecretAccessKey))) + console.Println(colorBlue("Region: ") + colorWhiteBold(fmt.Sprintf(getFormatStr(len(region), 3), region))) - console.Println(colorMagenta("\nBrowser Access:")) - console.Println(colorGreen(fmt.Sprintf(getFormatStr(len(endPointStr), 3), endPointStr))) + console.Println(colorBlue("\nBrowser Access:")) + console.Println(colorWhite(fmt.Sprintf(getFormatStr(len(endPointStr), 3), endPointStr))) } // Prints startup message for command line access. Prints link to our documentation @@ -72,21 +72,21 @@ func printCLIAccessMsg(endPoint string) { cred := serverConfig.GetCredential() // Configure 'mc', following block prints platform specific information for minio client. - console.Println(colorMagenta("\nCommand-line Access: ") + colorWhite(mcQuickStartGuide)) + console.Println(colorBlue("\nCommand-line Access: ") + colorWhite(mcQuickStartGuide)) if runtime.GOOS == "windows" { mcMessage := fmt.Sprintf("$ mc.exe config host add myminio %s %s %s", endPoint, cred.AccessKeyID, cred.SecretAccessKey) - console.Println(fmt.Sprintf(getFormatStr(len(mcMessage), 3), mcMessage)) + console.Println(colorWhite(fmt.Sprintf(getFormatStr(len(mcMessage), 3), mcMessage))) } else { - mcMessage := fmt.Sprintf("$ ./mc config host add myminio %s %s %s", endPoint, cred.AccessKeyID, cred.SecretAccessKey) - console.Println(fmt.Sprintf(getFormatStr(len(mcMessage), 3), mcMessage)) + mcMessage := fmt.Sprintf("$ mc config host add myminio %s %s %s", endPoint, cred.AccessKeyID, cred.SecretAccessKey) + console.Println(colorWhite(fmt.Sprintf(getFormatStr(len(mcMessage), 3), mcMessage))) } } // Prints startup message for Object API acces, prints link to our SDK documentation. func printObjectAPIMsg() { - console.Println("\nObject API (Amazon S3 compatible):") - console.Println(" Go: " + fmt.Sprintf(getFormatStr(len(goQuickStartGuide), 8), goQuickStartGuide)) - console.Println(" Java: " + fmt.Sprintf(getFormatStr(len(javaQuickStartGuide), 6), javaQuickStartGuide)) - console.Println(" Python: " + fmt.Sprintf(getFormatStr(len(pyQuickStartGuide), 4), pyQuickStartGuide)) - console.Println(" JavaScript: " + jsQuickStartGuide) + console.Println(colorBlue("\nObject API (Amazon S3 compatible):")) + console.Println(colorBlue(" Go: ") + colorWhite(fmt.Sprintf(getFormatStr(len(goQuickStartGuide), 8), goQuickStartGuide))) + console.Println(colorBlue(" Java: ") + colorWhite(fmt.Sprintf(getFormatStr(len(javaQuickStartGuide), 6), javaQuickStartGuide))) + console.Println(colorBlue(" Python: ") + colorWhite(fmt.Sprintf(getFormatStr(len(pyQuickStartGuide), 4), pyQuickStartGuide))) + console.Println(colorBlue(" JavaScript: ") + colorWhite(jsQuickStartGuide)) }