當前位置: 首頁>>代碼示例>>Golang>>正文


Golang prettyprint.Colorize函數代碼示例

本文整理匯總了Golang中github.com/deis/pkg/prettyprint.Colorize函數的典型用法代碼示例。如果您正苦於以下問題:Golang Colorize函數的具體用法?Golang Colorize怎麽用?Golang Colorize使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Colorize函數的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestRemove

func TestRemove(t *testing.T) {
	tmpHome := createTmpHome()
	fakeUpdate(tmpHome)

	Fetch("kitchensink", "", tmpHome)

	var output bytes.Buffer
	log.Stderr = &output

	Remove("kitchensink", tmpHome)

	expected := pretty.Colorize("{{.Green}}--->{{.Default}} ") + "All clear! You have successfully removed kitchensink from your workspace.\n"

	expect(t, output.String(), expected)

	// reset log
	log.Stdout = os.Stdout
}
開發者ID:prydonius,項目名稱:helm-classic,代碼行數:18,代碼來源:remove_test.go

示例2: addColor

func addColor(str string, color Color) string {
	return prettyprint.Colorize(fmt.Sprintf("%s%s%s", color.String(), str, Default.String()))
}
開發者ID:deis,項目名稱:pkg,代碼行數:3,代碼來源:log.go

示例3: die

func die(err error) {
	m := "{{.Red}}[BOO!]{{.Default}} " + err.Error()
	fmt.Println(pretty.Colorize(m))
	os.Exit(1)
}
開發者ID:technosophos,項目名稱:k8splace,代碼行數:5,代碼來源:kp.go

示例4: ftw

func ftw(msg string, args ...interface{}) {
	t := fmt.Sprintf(msg, args...)
	m := "{{.Green}}[YAY!]{{.Default}} " + t
	fmt.Println(pretty.Colorize(m))
}
開發者ID:technosophos,項目名稱:k8splace,代碼行數:5,代碼來源:kp.go

示例5: info

func info(msg string, args ...interface{}) {
	t := fmt.Sprintf(msg, args...)
	m := "{{.Yellow}}[INFO]{{.Default}} " + t
	fmt.Println(pretty.Colorize(m))
}
開發者ID:technosophos,項目名稱:k8splace,代碼行數:5,代碼來源:kp.go

示例6: Warn

// Warn prints a yellow-tinted warning message.
func Warn(format string, v ...interface{}) {
	fmt.Fprint(Stderr, pretty.Colorize("{{.Yellow}}[WARN]{{.Default}} "))
	Msg(format, v...)
}
開發者ID:fabric8io,項目名稱:helm,代碼行數:5,代碼來源:log.go

示例7: Debug

// Debug prints a cyan-tinted message if IsDebugging is true.
func Debug(msg string, v ...interface{}) {
	if IsDebugging {
		fmt.Fprint(Stderr, pretty.Colorize("{{.Cyan}}[DEBUG]{{.Default}} "))
		Msg(msg, v...)
	}
}
開發者ID:fabric8io,項目名稱:helm,代碼行數:7,代碼來源:log.go

示例8: Info

// Info prints a green-tinted message.
func Info(format string, v ...interface{}) {
	fmt.Fprint(Stderr, pretty.Colorize("{{.Green}}--->{{.Default}} "))
	fmt.Fprintf(Stderr, appendNewLine(format), v...)
}
開發者ID:fabric8io,項目名稱:helm,代碼行數:5,代碼來源:log.go

示例9: Err

// Err prints an error message. It does not cause an exit.
func Err(format string, v ...interface{}) {
	fmt.Fprint(Stderr, pretty.Colorize("{{.Red}}[ERROR]{{.Default}} "))
	fmt.Fprintf(Stderr, appendNewLine(format), v...)
}
開發者ID:fabric8io,項目名稱:helm,代碼行數:5,代碼來源:log.go

示例10: New

// New creates a *log.Logger that writes to this source.
func New() *log.Logger {
	ll := log.New(Stdout, pretty.Colorize("{{.Yellow}}--->{{.Default}} "), 0)
	return ll
}
開發者ID:fabric8io,項目名稱:helm,代碼行數:5,代碼來源:log.go

示例11: Warn

// Warn prints a yellow-tinted warning message.
func Warn(format string, v ...interface{}) {
	fmt.Fprint(Stderr, pretty.Colorize("{{.Yellow}}[WARN]{{.Default}} "))
	fmt.Fprintf(Stderr, appendNewLine(format), v...)
}
開發者ID:michelleN,項目名稱:helm,代碼行數:5,代碼來源:log.go

示例12: Debug

// Debug prints a cyan-tinted message if IsDebugging is true.
func Debug(format string, v ...interface{}) {
	if IsDebugging {
		fmt.Fprint(Stderr, pretty.Colorize("{{.Cyan}}[DEBUG]{{.Default}} "))
		fmt.Fprintf(Stderr, appendNewLine(format), v...)
	}
}
開發者ID:michelleN,項目名稱:helm,代碼行數:7,代碼來源:log.go


注:本文中的github.com/deis/pkg/prettyprint.Colorize函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。