• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang color.Blue函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/fatih/color.Blue函数的典型用法代码示例。如果您正苦于以下问题:Golang Blue函数的具体用法?Golang Blue怎么用?Golang Blue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Blue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {

	Repo := [6]string{"https://github.com/EgeBalci/ARCANUS/blob/master/SOURCE/ARCANUS.go", "https://github.com/EgeBalci/ARCANUS/raw/master/ARCANUS_x64", "https://github.com/EgeBalci/ARCANUS/raw/master/ARCANUS_x64.exe", "https://github.com/EgeBalci/ARCANUS/raw/master/ARCANUS_x86", "https://github.com/EgeBalci/ARCANUS/raw/master/ARCANUS_x86.exe", "https://github.com/EgeBalci/ARCANUS/raw/master/README.md"}

	if runtime.GOOS == "windows" {
		exec.Command("cmd", "/C", "msg ARCANUS Update Started...").Run()
		exec.Command("cmd", "/C", "del ARCANUS.go").Run()
		exec.Command("cmd", "/C", "del ARCANUS_x64.exe").Run()
		exec.Command("cmd", "/C", "del ARCANUS_x86.exe").Run()
		exec.Command("cmd", "/C", "del ARCANUS_x64").Run()
		exec.Command("cmd", "/C", "del ARCANUS_x86").Run()
		color.Blue("[*] Updating ARCANUS...\n\n")
		for i := 0; i < len(Repo); i++ {
			response, _ := http.Get(Repo[i])
			defer response.Body.Close()
			body, _ := ioutil.ReadAll(response.Body)

			Name := strings.Split(Repo[i], "/")
			color.Green("#	" + string(Name[(len(Name)-1)]) + "		[OK]")
			file, _ := os.Create(string(Name[(len(Name) - 1)]))

			file.WriteString(string(body))
		}
		/*ARC, _ := exec.Command("cmd", "/C", "echo %PROCESSOR_ARCHITECTURE%").Output()
		if strings.Contains(string(ARC), "x86") || strings.Contains(string(ARC), "X86") {
			exec.Command("cmd", "/C", "ARCANUS_x86.exe").Start()
		}else if strings.Contains(string(ARC), "AMD64") {
			exec.Command("cmd", "/C", "ARCANUS_x64.exe").Start()
		}*/
		exec.Command("cmd", "/C", "msg * ARCANUS Updated Succesfuly !").Run()
	} else if runtime.GOOS == "linux" {
		exec.Command("sh", "-c", "zenity --info --text=\"ARCANUS Update Started... \"").Run()
		exec.Command("sh", "-c", "rm ARCANUS.go").Run()
		exec.Command("sh", "-c", "rm ARCANUS_x64.exe").Run()
		exec.Command("sh", "-c", "rm ARCANUS_x86.exe").Run()
		exec.Command("sh", "-c", "rm ARCANUS_x64").Run()
		exec.Command("sh", "-c", "rm ARCANUS_x86").Run()
		color.Blue("[*] Updating ARCANUS...\n\n")
		for i := 0; i < len(Repo); i++ {
			response, _ := http.Get(Repo[i])
			defer response.Body.Close()
			body, _ := ioutil.ReadAll(response.Body)

			Name := strings.Split(Repo[i], "/")
			color.Green("#	" + string(Name[(len(Name)-1)]) + "		[OK]")
			file, _ := os.Create(string(Name[(len(Name) - 1)]))

			file.WriteString(string(body))
		}
		exec.Command("sh", "-c", "zenity --info --text=\"ARCANUS Updated Succesfuly !\"").Run()
		/*ARC, _ := exec.Command("sh", "-c", "uname -a").Output()
		if strings.Contains(string(ARC), "x86") || strings.Contains(string(ARC), "X86") {
			exec.Command("sh", "-c", "./ARCANUS_x86").Start()
		}else if strings.Contains(string(ARC), "amd64") {
			exec.Command("sh", "-c", "./ARCANUS_x64").Start()
		}*/

	}

}
开发者ID:RuthHaephrati,项目名称:ARCANUS,代码行数:60,代码来源:Update.go


示例2: userInputFrequency

func userInputFrequency(reader *bufio.Reader) time.Duration {
	color.Blue("Backup Frequency, use a short string like: 30m or 2h43m10s")
	color.Blue("Valid time units are: h, m, s")
	fmt.Println("")
	fmt.Print("Backup Every: ")
	text, _ := reader.ReadString('\n')
	text = strings.TrimSpace(text)
	d, err := time.ParseDuration(text)
	if err != nil {
		color.Red("Error parsing frequency, try again")
		return userInputFrequency(reader)
	}
	return d
}
开发者ID:sparrc,项目名称:stash,代码行数:14,代码来源:destination.go


示例3: main

func main() {
	if all_ssh.ArgsInfo.IP != "" {
		color.Yellow("开始登录:%s\n", all_ssh.ArgsInfo.IP)
		var v all_ssh.ConnetctionInfo
		for _, v = range all_ssh.ServerList {
			if v.IP == all_ssh.ArgsInfo.IP {
				break
			}
		}
		v.IP = all_ssh.ArgsInfo.IP
		client := all_ssh.Connection(v)
		if client == nil {
			return
		}
		err := all_ssh.TtyClient(client)
		if err != nil {
			println(err.Error())
		}
		if len(all_ssh.ErrorList) >= 1 {
			color.Red(all_ssh.ErrorList[0])
		}
		return
	}
	if all_ssh.ArgsInfo.File != "" {
		copyfile()
		return
	}
	if all_ssh.ArgsInfo.Cmd != "" {
		runcmd()
		return
	}
	color.Blue("使用%s -h查看帮助.\n", os.Args[0])
}
开发者ID:czxichen,项目名称:Goprograme,代码行数:33,代码来源:ssh_maste.go


示例4: copyfile

func copyfile() {
	color.Yellow("开始执行文件发送:")
	info, err := os.Lstat(all_ssh.ArgsInfo.File)
	if err != nil || info.IsDir() {
		color.Blue("检查要发送的文件.")
		return
	}
	for _, v := range all_ssh.ServerList {
		go func() {
			client := all_ssh.Connection(v)
			if client != nil {
				all_ssh.CopyFile(client, all_ssh.ArgsInfo.File, all_ssh.ArgsInfo.Dir)
			}
		}()
	}
	var num int
	var Over chan os.Signal = make(chan os.Signal, 1)
	go signal.Notify(Over, os.Interrupt, os.Kill)
	go result(&num, Over)
	<-Over
	color.Yellow("一共有%d条错误.\n", len(all_ssh.ErrorList))
	for _, v := range all_ssh.ErrorList {
		color.Red(v)
	}
	color.Red("收到结果:%d条\n", num)
}
开发者ID:czxichen,项目名称:Goprograme,代码行数:26,代码来源:ssh_maste.go


示例5: main

// TEST="asdf,asdf,asdf" ./main template.tpl
func main() {

	if len(os.Args) != 2 {
		color.Red("tenv: v.01")
		color.Blue("------------------------")
		color.Cyan("Prepopulates to stdin given template with information stored in env variables")
		color.Cyan("variables should follow go template syntax {{.VAR_NAME}}")
		color.Cyan("and must be declared on the environment")
		color.Cyan("Usage : tenv filename")
		os.Exit(1)
	}
	var funcMap template.FuncMap
	funcMap = template.FuncMap{
		"split": strings.Split,
	}

	file := filepath.Base(os.Args[1])

	t, err := template.New(file).Funcs(funcMap).ParseFiles(os.Args[1])
	if err != nil {
		log.Fatalf("Error: %s", err)
	}

	context := make(map[string]string)
	for _, v := range os.Environ() {
		p := strings.Split(v, "=")
		context[p[0]] = p[1]
	}

	err = t.ExecuteTemplate(os.Stdout, file, context)
	if err != nil {
		log.Fatal(err)
	}

}
开发者ID:jordic,项目名称:tenv,代码行数:36,代码来源:main.go


示例6: main

func main() {
	checkArgs()
	url := os.Args[1]
	directory := os.Args[2]

	r, err := git.NewFilesystemRepository(directory)
	checkIfError(err)

	// Clone the given repository, using depth we create a shallow clone :
	// > git clone <url> --depth 1
	color.Blue("git clone %s --depth 1 %s", url, directory)

	err = r.Clone(&git.CloneOptions{
		URL: url,
	})
	checkIfError(err)

	// ... retrieving the branch being pointed by HEAD
	ref, err := r.Head()
	checkIfError(err)
	// ... retrieving the commit object
	commit, err := r.Commit(ref.Hash())
	checkIfError(err)

	fmt.Println(commit)
	os.Exit(0)

	// ... we get all the files from the commit
	files, err := commit.Files()
	checkIfError(err)

	// ... now we iterate the files to save to disk
	err = files.ForEach(func(f *git.File) error {
		abs := filepath.Join(directory, f.Name)
		dir := filepath.Dir(abs)

		os.MkdirAll(dir, 0777)
		file, err := os.Create(abs)
		if err != nil {
			return err
		}

		defer file.Close()
		r, err := f.Reader()
		if err != nil {
			return err
		}

		defer r.Close()

		if err := file.Chmod(f.Mode); err != nil {
			return err
		}

		_, err = io.Copy(file, r)
		return err
	})
	checkIfError(err)
}
开发者ID:alcortesm,项目名称:go-git,代码行数:59,代码来源:main.go


示例7: clone

func clone(r *git.Repository, url string) {
	// Clone the given repository, all the objects, references and
	// configuration sush as remotes, are save into the Aerospike database.
	// > git clone <url>
	color.Blue("git clone %s", url)
	err := r.Clone(&git.CloneOptions{URL: url})
	checkIfError(err)
}
开发者ID:alcortesm,项目名称:go-git,代码行数:8,代码来源:main.go


示例8: userInputType

func userInputType(reader *bufio.Reader) string {
	color.Blue("Which type of backup destination would you like to add?")
	color.Blue("	1. Amazon (S3 or Glacier)")
	color.Blue("	2. Google Cloud")
	fmt.Println("")
	fmt.Print("Choose an option [1-2]: ")
	text, _ := reader.ReadString('\n')
	destType := strings.TrimSpace(text)
	switch destType {
	case "1":
		destType = "amazon"
	case "2":
		destType = "google"
	default:
		os.Exit(1)
	}
	return destType
}
开发者ID:sparrc,项目名称:stash,代码行数:18,代码来源:destination.go


示例9: verifyPlatform

// verifyPlatform should in the future verify that your {arch, platform,
// os, etc.} match for the given file
func (lib Lib) verifyPlatform() bool {
	out, err := execShellCmd("strings " + lib.Fname + " | grep " + runtime.GOOS)
	if err != nil {
		log.Println(err)
	}

	color.Blue(string(out))

	return true
}
开发者ID:deferpanic,项目名称:libby,代码行数:12,代码来源:main.go


示例10: show

func show(dict Dict) {
	for _, ps := range dict.Ps {
		color.Green(ps)
	}
	for index, pos := range dict.Pos {
		color.Red(strings.TrimSpace(pos))
		color.Yellow(strings.TrimSpace(dict.Acceptation[index]))
	}
	for _, sent := range dict.SentList {
		color.Blue("ex. %s", strings.TrimSpace(sent.Orig))
		color.Cyan("    %s", strings.TrimSpace(sent.Trans))
	}
}
开发者ID:Flowerowl,项目名称:ici.go,代码行数:13,代码来源:ici.go


示例11: main

func main() {
	var configFileContents []byte
	var conf Config
	var changedFiles []string
	var tests []string
	var err error

	if configFileContents, err = ioutil.ReadFile("testdiff.toml"); err != nil {
		color.Red("Loading configuration failed!")
		return
	}

	if _, err := toml.Decode(string(configFileContents), &conf); err != nil {
		color.Red("Loading configuration failed!")
		return
	}

	color.Blue("Scanning for changed files...")
	if changedFiles, err = findChangedFiles(conf); err != nil {
		color.Red("Diffing failed!")
		return
	}

	color.Blue("Determining what tests to run...")
	if tests, err = determineTestsToExecute(conf, changedFiles); err != nil {
		color.Red("Test locating failed!")
		return
	}

	color.Blue("Executing tests.")
	if err = executeTests(conf, tests); err != nil {
		color.Red("Running tests failed!")
		return
	}

	color.Green("All done!")
}
开发者ID:moosingin3space,项目名称:testdiff,代码行数:37,代码来源:main.go


示例12: ghostInTheCircuits

// This SIFT app will randomly alter any detected lights
func ghostInTheCircuits(server *sift.Server, minMS, maxMS int) {
	for {
		// Wait for a random amount of time
		<-time.After(randTime(minMS, maxMS))

		// Get all lights connected to the system
		lightsQuery := `
			SELECT c.name, c.device_id FROM component c
				JOIN device d ON c.device_id=d.id
				WHERE is_online=1 AND type=?`
		lights := []db.Component{}
		db, err := server.DB()
		if err != nil {
			color.Red("could not open DB: %v", err)
		}
		// run the query
		if err = db.Select(&lights, lightsQuery, types.LightEmitter{}.Type()); err != nil {
			color.Red("could not run query to get light ids: %v", err)
		}

		if len(lights) == 0 {
			color.Red("no lights found for the circuit ghosts to play with...")
		} else {
			// For each light found...
			for _, light := range lights {
				// ...assemble a component ID...
				lightID := types.ComponentID{
					Name:     light.Name,
					DeviceID: types.DeviceID(light.DeviceID),
				}

				// ...generate a random brightness value (0-100)...
				randBrightness := uint8(rand.Intn(100))

				// ...then create and submit an intent
				newLightIntent := types.SetLightEmitterIntent{
					BrightnessInPercent: randBrightness,
				}
				if err := server.EnactIntent(lightID, newLightIntent); err != nil {
					color.Red("could not enact intent: %v", err)
				} else {
					color.Blue("set light %v to %v", lightID, randBrightness)
				}
			}
		}
	}
}
开发者ID:upwrd,项目名称:sift,代码行数:48,代码来源:ghostInTheCircuits.go


示例13: repeatUpdatesToConsole

// main starts a sift server and listens for updates, printing any to console.
func repeatUpdatesToConsole(server *sift.Server) {
	myToken := server.Login()
	updateChan := server.Listen(myToken) // without specifying filters, this will listen to everything

	fmt.Println("listening to SIFT server and printing updates to console...")
	for {
		update := <-updateChan //TODO: uncaught panic if updateChan is closed
		switch typed := update.(type) {
		case notif.ComponentNotification:
			color.Blue("component %+v %v: %+v\n", typed.ID, typed.Action, typed.Component)
		//case notif.DriverNotification:
		//	fmt.Printf("driver %v: %v", typed.NotificationType, typed.Component)
		default:
			color.Red("unhandled update type from updateChan: %T (%v)\n", update, update)
		}
	}
}
开发者ID:upwrd,项目名称:sift,代码行数:18,代码来源:repeatToConsole.go


示例14: runDelete

func runDelete(args []string) {
	config := stash.NewConfig()
	reader := bufio.NewReader(os.Stdin)
	color.Red("WARNING! Deleted entries cannot be recovered")
	color.Blue("Please choose one of the following entries: ")
	for _, entry := range config.Entries {
		color.Magenta("	%s", entry.Name)
	}
	fmt.Println()
	fmt.Print("Entry to delete (case-sensitive): ")
	text, _ := reader.ReadString('\n')
	text = strings.TrimSpace(text)
	err := config.DeleteEntry(text)
	if err != nil {
		color.Red("Fatal error deleting an entry: %s", err)
		os.Exit(1)
	}
}
开发者ID:sparrc,项目名称:stash,代码行数:18,代码来源:destination.go


示例15: strike_create

func strike_create(c *cli.Context) error {
	url := c.GlobalString("url")
	if url == "" {
		return cli.NewExitError("A URL must be provided with the SCALE_URL environment variable or the --url argument", 1)
	}
	data_file := c.String("data")
	var strike_data scalecli.StrikeData
	err := Parse_json_or_yaml(data_file, &strike_data)
	if err != nil {
		return cli.NewExitError(err.Error(), 1)
	}
	strike_process_id, err := scalecli.CreateStrikeProcess(url, strike_data)
	if err != nil {
		return cli.NewExitError(err.Error(), 1)
	}
	color.Blue(fmt.Sprintf("Strike process %d created.", strike_process_id))
	return nil
}
开发者ID:ngageoint,项目名称:scale,代码行数:18,代码来源:strike.go


示例16: log

func log(r *git.Repository) {
	// Prints the history of the repository starting in the current HEAD, the
	// objects are retrieved from Aerospike database.
	// > git log --oneline
	color.Blue("git log --oneline")

	ref, err := r.Head()
	checkIfError(err)
	commit, err := r.Commit(ref.Hash())
	checkIfError(err)
	commits, err := commit.History()
	checkIfError(err)

	for _, c := range commits {
		hash := c.Hash.String()
		line := strings.Split(c.Message, "\n")
		fmt.Println(hash[:7], line[0])
	}
}
开发者ID:alcortesm,项目名称:go-git,代码行数:19,代码来源:main.go


示例17: printIssueDetails

func printIssueDetails(body []byte) {
	issue := Issue{}
	err := json.Unmarshal(body, &issue)
	if err != nil {
		color.Red(err.Error())
		return
	}

	if issue.Title != "" {
		color.Green("[ #" + issue.Path() + "] " + issue.Title)
		fmt.Println(issue.Body)
		color.Blue(issue.URL)
		fmt.Println(issue.Status)
	} else {
		err := Error{}
		json.Unmarshal(body, &err)
		color.Red("ERROR: " + err.Message)

	}
}
开发者ID:supu-io,项目名称:supu,代码行数:20,代码来源:issue.go


示例18: CloseChildren

func CloseChildren(cfg Config) {
	parent := GetBug(strconv.Itoa(cfg.Bugzilla.Parent), cfg)
	if parent.Id == cfg.Bugzilla.Parent {
		for _, alias := range cfg.Bugzilla.Child {
			child := GetBug(alias, cfg)
			if child.Alias == alias {
				fmt.Printf("bug %v found for %v\n", child.Id, child.Alias)
				if ContainsInt(cfg.Bugzilla.Parent, child.DependsOn) {
					color.Blue(" - is linked to parent %v", cfg.Bugzilla.Parent)
					if child.IsOpen {
						if Resolve(parent.Id, child.Id, fmt.Sprint("deallocated from bug ", parent.Id), cfg) {
							color.Green(" - resolved %v (%v) and deallocated from parent %v", child.Id, child.Alias, parent.Id)
						}
					}
				} else {
					color.Yellow(" - not linked to parent %v", cfg.Bugzilla.Parent)
				}
			}
		}
	}
}
开发者ID:grenade,项目名称:minionator,代码行数:21,代码来源:minionator.go


示例19: main

// Usage: giphy-to-clipboard url
// url should be a resource at i.giphy.com, though theoretically this program
// can copy an arbitrary resource into a file named giphy.gif. This is probably
// insecure and most likely should be avoided
func main() {
	flag.Parse()
	args := flag.Args()
	if len(args) == 0 {
		color.Blue("Usage: giphy-to-clipboard <giphy url>")
		return
	}
	url := args[0]
	_, err := downloadFromFile(url)
	if err != nil {
		color.Red(fmt.Sprintf("Error copying %s", url))
		return
	}
	fmt.Println("Copying", url, " to clipboard")
	err = copyToClipboard()
	if err != nil {
		errString := fmt.Sprintf("Copying %s, to clipboard failed. Encountered error: %s", url, err)
		color.Red(errString)
		return
	}
	color.Green("Your GIF has been copied!")
}
开发者ID:while1malloc0,项目名称:giphy-to-clipboard,代码行数:26,代码来源:giphy-to-clipboard.go


示例20: colorLineDiff

func colorLineDiff(a, b string) {
	aLines := strings.Split(a, "\n")
	bLines := strings.Split(b, "\n")

	fmt.Print("Overlapping portion of reassembled TCP Stream:\n")
	for i := 0; i < len(aLines); i++ {
		if aLines[i] == bLines[i] {
			color.Blue(aLines[i])
		} else {
			color.Green(aLines[i])
		}
	}

	fmt.Print("Injection packet whose contents did not coalesce into the TCP Stream:\n")
	for i := 0; i < len(aLines); i++ {
		if aLines[i] == bLines[i] {
			color.Cyan(bLines[i])
		} else {
			color.Red(bLines[i])
		}
	}

}
开发者ID:roger2000hk,项目名称:HoneyBadger,代码行数:23,代码来源:main.go



注:本文中的github.com/fatih/color.Blue函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang color.BlueString函数代码示例发布时间:2022-05-23
下一篇:
Golang camelcase.Split函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap