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.
master
Harshavardhana 8 years ago committed by Anand Babu (AB) Periasamy
parent dc3bafb194
commit 8c84df5e74
  1. 8
      access-key.go
  2. 6
      globals.go
  3. 30
      server-startup-msg.go

@ -19,7 +19,6 @@ package main
import ( import (
"crypto/rand" "crypto/rand"
"encoding/base64" "encoding/base64"
"fmt"
"regexp" "regexp"
) )
@ -29,13 +28,6 @@ type credential struct {
SecretAccessKey string `json:"secretKey"` 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 ( const (
minioAccessID = 20 minioAccessID = 20
minioSecretID = 40 minioSecretID = 40

@ -55,7 +55,7 @@ var (
// global colors. // global colors.
var ( var (
colorMagenta = color.New(color.FgMagenta, color.Bold).SprintfFunc() colorWhite = color.New(color.FgWhite).SprintfFunc()
colorWhite = color.New(color.FgWhite, color.Bold).SprintfFunc() colorWhiteBold = color.New(color.FgWhite, color.Bold).SprintfFunc()
colorGreen = color.New(color.FgGreen, color.Bold).SprintfFunc() colorBlue = color.New(color.FgBlue).SprintfFunc()
) )

@ -56,13 +56,13 @@ func printServerCommonMsg(endPoints []string) {
endPointStr := strings.Join(endPoints, " ") endPointStr := strings.Join(endPoints, " ")
// Colorize the message and print. // Colorize the message and print.
console.Println(colorMagenta("\nEndpoint: ") + colorGreen(fmt.Sprintf(getFormatStr(len(endPointStr), 1), endPointStr))) console.Println(colorBlue("\nEndpoint: ") + colorWhiteBold(fmt.Sprintf(getFormatStr(len(endPointStr), 1), endPointStr)))
console.Println(colorMagenta("AccessKey: ") + colorWhite(fmt.Sprintf("%s ", cred.AccessKeyID))) console.Println(colorBlue("AccessKey: ") + colorWhiteBold(fmt.Sprintf("%s ", cred.AccessKeyID)))
console.Println(colorMagenta("SecretKey: ") + colorWhite(fmt.Sprintf("%s ", cred.SecretAccessKey))) console.Println(colorBlue("SecretKey: ") + colorWhiteBold(fmt.Sprintf("%s ", cred.SecretAccessKey)))
console.Println(colorMagenta("Region: ") + colorWhite(fmt.Sprintf(getFormatStr(len(region), 3), region))) console.Println(colorBlue("Region: ") + colorWhiteBold(fmt.Sprintf(getFormatStr(len(region), 3), region)))
console.Println(colorMagenta("\nBrowser Access:")) console.Println(colorBlue("\nBrowser Access:"))
console.Println(colorGreen(fmt.Sprintf(getFormatStr(len(endPointStr), 3), endPointStr))) console.Println(colorWhite(fmt.Sprintf(getFormatStr(len(endPointStr), 3), endPointStr)))
} }
// Prints startup message for command line access. Prints link to our documentation // Prints startup message for command line access. Prints link to our documentation
@ -72,21 +72,21 @@ func printCLIAccessMsg(endPoint string) {
cred := serverConfig.GetCredential() cred := serverConfig.GetCredential()
// Configure 'mc', following block prints platform specific information for minio client. // 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" { if runtime.GOOS == "windows" {
mcMessage := fmt.Sprintf("$ mc.exe config host add myminio %s %s %s", endPoint, cred.AccessKeyID, cred.SecretAccessKey) 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 { } else {
mcMessage := fmt.Sprintf("$ ./mc config host add myminio %s %s %s", endPoint, cred.AccessKeyID, cred.SecretAccessKey) 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)) console.Println(colorWhite(fmt.Sprintf(getFormatStr(len(mcMessage), 3), mcMessage)))
} }
} }
// Prints startup message for Object API acces, prints link to our SDK documentation. // Prints startup message for Object API acces, prints link to our SDK documentation.
func printObjectAPIMsg() { func printObjectAPIMsg() {
console.Println("\nObject API (Amazon S3 compatible):") console.Println(colorBlue("\nObject API (Amazon S3 compatible):"))
console.Println(" Go: " + fmt.Sprintf(getFormatStr(len(goQuickStartGuide), 8), goQuickStartGuide)) console.Println(colorBlue(" Go: ") + colorWhite(fmt.Sprintf(getFormatStr(len(goQuickStartGuide), 8), goQuickStartGuide)))
console.Println(" Java: " + fmt.Sprintf(getFormatStr(len(javaQuickStartGuide), 6), javaQuickStartGuide)) console.Println(colorBlue(" Java: ") + colorWhite(fmt.Sprintf(getFormatStr(len(javaQuickStartGuide), 6), javaQuickStartGuide)))
console.Println(" Python: " + fmt.Sprintf(getFormatStr(len(pyQuickStartGuide), 4), pyQuickStartGuide)) console.Println(colorBlue(" Python: ") + colorWhite(fmt.Sprintf(getFormatStr(len(pyQuickStartGuide), 4), pyQuickStartGuide)))
console.Println(" JavaScript: " + jsQuickStartGuide) console.Println(colorBlue(" JavaScript: ") + colorWhite(jsQuickStartGuide))
} }

Loading…
Cancel
Save