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


Golang console.SetCustomPalette函數代碼示例

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


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

示例1: setMainPalette

func setMainPalette(style string) {
	console.SetCustomPalette(map[string]*color.Color{
		"Debug":  color.New(color.FgWhite, color.Faint, color.Italic),
		"Fatal":  color.New(color.FgRed, color.Italic, color.Bold),
		"Error":  color.New(color.FgYellow, color.Italic),
		"Info":   color.New(color.FgGreen, color.Bold),
		"Print":  color.New(),
		"PrintC": color.New(color.FgGreen, color.Bold),
	})
	if style == "light" {
		console.SetCustomPalette(map[string]*color.Color{
			"Debug":  color.New(color.FgWhite, color.Faint, color.Italic),
			"Fatal":  color.New(color.FgWhite, color.Italic, color.Bold),
			"Error":  color.New(color.FgWhite, color.Italic, color.Bold),
			"Info":   color.New(color.FgWhite, color.Bold),
			"Print":  color.New(),
			"PrintC": color.New(color.FgWhite, color.Bold),
		})
		return
	}
	/// Add more styles here
	if style == "nocolor" {
		// All coloring options exhausted, setting nocolor safely
		console.SetNoColor()
	}
}
開發者ID:dudymas,項目名稱:mc,代碼行數:26,代碼來源:main.go

示例2: setAccessPalette

func setAccessPalette(style string) {
	console.SetCustomPalette(map[string]*color.Color{
		"Access": color.New(color.FgGreen, color.Bold),
	})
	if style == "light" {
		console.SetCustomPalette(map[string]*color.Color{
			"Access": color.New(color.FgWhite, color.Bold),
		})
	}
	if style == "nocolor" {
		// ALl coloring options exhausted, setting nocolor safely
		console.SetNoColor()
	}
}
開發者ID:henrylee2cn,項目名稱:mc,代碼行數:14,代碼來源:access-main.go

示例3: setMakeBucketPalette

func setMakeBucketPalette(style string) {
	console.SetCustomPalette(map[string]*color.Color{
		"MakeBucket": color.New(color.FgGreen, color.Bold),
	})
	if style == "light" {
		console.SetCustomPalette(map[string]*color.Color{
			"MakeBucket": color.New(color.FgWhite, color.Bold),
		})
		return
	}
	if style == "nocolor" {
		// All coloring options exhausted, setting nocolor safely
		console.SetNoColor()
	}
}
開發者ID:henrylee2cn,項目名稱:mc,代碼行數:15,代碼來源:mb-main.go

示例4: setCopyPalette

func setCopyPalette(style string) {
	console.SetCustomPalette(map[string]*color.Color{
		"Copy": color.New(color.FgGreen, color.Bold),
	})
	if style == "light" {
		console.SetCustomPalette(map[string]*color.Color{
			"Copy": color.New(color.FgWhite, color.Bold),
		})
		return
	}
	/// Add more styles here
	if style == "nocolor" {
		// All coloring options exhausted, setting nocolor safely
		console.SetNoColor()
	}
}
開發者ID:dudymas,項目名稱:mc,代碼行數:16,代碼來源:cp-main.go

示例5: newProgressBar

// newProgressBar - instantiate a pbBar.
func newProgressBar(total int64) *barSend {
	console.SetCustomPalette(map[string]*color.Color{
		"Bar": color.New(color.FgGreen, color.Bold),
	})
	cmdCh := make(chan barMsg)
	finishCh := make(chan bool)
	go func(total int64, cmdCh <-chan barMsg, finishCh chan<- bool) {
		var started bool
		var totalBytesRead int64 // total amounts of bytes read
		bar := pb.New64(total)
		bar.SetUnits(pb.U_BYTES)
		bar.SetRefreshRate(time.Millisecond * 125)
		bar.NotPrint = true
		bar.ShowSpeed = true
		bar.Callback = func(s string) {
			console.Print(console.Colorize("Bar", "\r"+s))
		}
		switch runtime.GOOS {
		case "linux":
			bar.Format("┃▓█░┃")
			// bar.Format("█▓▒░█")
		case "darwin":
			bar.Format(" ▓ ░ ")
		default:
			bar.Format("[=> ]")
		}
		for msg := range cmdCh {
			switch msg.Op {
			case pbBarSetCaption:
				bar.Prefix(fixateBarCaption(msg.Arg.(string), getFixedWidth(bar.GetWidth(), 18)))
			case pbBarProgress:
				if bar.Total > 0 && !started {
					started = true
					bar.Start()
				}
				if msg.Arg.(int64) > 0 {
					totalBytesRead += msg.Arg.(int64)
					bar.Add64(msg.Arg.(int64))
				}
			case pbBarPutError:
				if totalBytesRead > msg.Arg.(int64) {
					bar.Set64(totalBytesRead - msg.Arg.(int64))
				}
			case pbBarGetError:
				if msg.Arg.(int64) > 0 {
					bar.Add64(msg.Arg.(int64))
				}
			case pbBarFinish:
				if started {
					bar.Finish()
				}
				finishCh <- true
				return
			}
		}
	}(total, cmdCh, finishCh)
	return &barSend{cmdCh, finishCh}
}
開發者ID:dudymas,項目名稱:mc,代碼行數:59,代碼來源:progress-bar.go

示例6: setSessionPalette

func setSessionPalette(style string) {
	console.SetCustomPalette(map[string]*color.Color{
		"Command":      color.New(color.FgWhite, color.Bold),
		"SessionID":    color.New(color.FgYellow, color.Bold),
		"SessionTime":  color.New(color.FgGreen),
		"ClearSession": color.New(color.FgGreen, color.Bold),
	})
	if style == "light" {
		console.SetCustomPalette(map[string]*color.Color{
			"Command":      color.New(color.FgWhite, color.Bold),
			"SessionID":    color.New(color.FgWhite, color.Bold),
			"SessionTime":  color.New(color.FgWhite, color.Bold),
			"ClearSession": color.New(color.FgWhite, color.Bold),
		})
		return
	}
	/// Add more styles here
	if style == "nocolor" {
		// All coloring options exhausted, setting nocolor safely
		console.SetNoColor()
	}
}
開發者ID:henrylee2cn,項目名稱:mc,代碼行數:22,代碼來源:session-main.go

示例7: setListPalette

func setListPalette(style string) {
	console.SetCustomPalette(map[string]*color.Color{
		"File": color.New(color.FgWhite),
		"Dir":  color.New(color.FgCyan, color.Bold),
		"Size": color.New(color.FgYellow),
		"Time": color.New(color.FgGreen),
	})
	if style == "light" {
		console.SetCustomPalette(map[string]*color.Color{
			"File": color.New(color.FgWhite, color.Bold),
			"Dir":  color.New(color.FgWhite, color.Bold),
			"Size": color.New(color.FgWhite, color.Bold),
			"Time": color.New(color.FgWhite, color.Bold),
		})
		return
	}
	/// Add more styles here
	if style == "nocolor" {
		// All coloring options exhausted, setting nocolor safely
		console.SetNoColor()
	}
}
開發者ID:henrylee2cn,項目名稱:mc,代碼行數:22,代碼來源:ls-main.go

示例8: setDiffPalette

func setDiffPalette(style string) {
	console.SetCustomPalette(map[string]*color.Color{
		"DiffMessage":     color.New(color.FgGreen, color.Bold),
		"DiffOnlyInFirst": color.New(color.FgRed, color.Bold),
		"DiffType":        color.New(color.FgYellow, color.Bold),
		"DiffSize":        color.New(color.FgMagenta, color.Bold),
	})
	if style == "light" {
		console.SetCustomPalette(map[string]*color.Color{
			"DiffMessage":     color.New(color.FgWhite, color.Bold),
			"DiffOnlyInFirst": color.New(color.FgWhite, color.Bold),
			"DiffType":        color.New(color.FgWhite, color.Bold),
			"DiffSize":        color.New(color.FgWhite, color.Bold),
		})
		return
	}
	/// Add more styles here
	if style == "nocolor" {
		// All coloring options exhausted, setting nocolor safely
		console.SetNoColor()
	}
}
開發者ID:henrylee2cn,項目名稱:mc,代碼行數:22,代碼來源:diff-main.go

示例9: setSharePalette

func setSharePalette(style string) {
	console.SetCustomPalette(map[string]*color.Color{
		"Share":   color.New(color.FgGreen, color.Bold),
		"Expires": color.New(color.FgRed, color.Bold),
		"URL":     color.New(color.FgCyan, color.Bold),
		"File":    color.New(color.FgRed, color.Bold),
	})
	if style == "light" {
		console.SetCustomPalette(map[string]*color.Color{
			"Share":   color.New(color.FgWhite, color.Bold),
			"Expires": color.New(color.FgWhite, color.Bold),
			"URL":     color.New(color.FgWhite, color.Bold),
			"File":    color.New(color.FgWhite, color.Bold),
		})
		return
	}
	/// Add more styles here

	if style == "nocolor" {
		// All coloring options exhausted, setting nocolor safely
		console.SetNoColor()
	}
}
開發者ID:dudymas,項目名稱:mc,代碼行數:23,代碼來源:share.go

示例10: setConfigHostPalette

func setConfigHostPalette(style string) {
	console.SetCustomPalette(map[string]*color.Color{
		"Host":            color.New(color.FgCyan, color.Bold),
		"API":             color.New(color.FgYellow, color.Bold),
		"HostMessage":     color.New(color.FgGreen, color.Bold),
		"AccessKeyID":     color.New(color.FgBlue, color.Bold),
		"SecretAccessKey": color.New(color.FgRed, color.Bold),
	})
	if style == "light" {
		console.SetCustomPalette(map[string]*color.Color{
			"Host":            color.New(color.FgWhite, color.Bold),
			"API":             color.New(color.FgWhite, color.Bold),
			"HostMessage":     color.New(color.FgWhite, color.Bold),
			"AccessKeyID":     color.New(color.FgWhite, color.Bold),
			"SecretAccessKey": color.New(color.FgWhite, color.Bold),
		})
		return
	}
	/// Add more styles here
	if style == "nocolor" {
		// All coloring options exhausted, setting nocolor safely
		console.SetNoColor()
	}
}
開發者ID:dudymas,項目名稱:mc,代碼行數:24,代碼來源:config-host-main.go


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