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

Golang colorstring.Green函数代码示例

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

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



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

示例1: printFinishShare

func printFinishShare() {
	fmt.Println()
	log.Info(" * " + colorstring.Green("[OK] ") + "Yeah!! You rock!!")
	fmt.Println()
	fmt.Println("   " + GuideTextForFinish())
	fmt.Println()
	msg := `   You can create a pull request in your forked StepLib repository,
   if you used the main StepLib repository then your repository's url looks like: ` + `
   ` + colorstring.Green("https://github.com/[your-username]/bitrise-steplib") + `

   On GitHub you can find a ` + colorstring.Green("'Compare & pull request'") + ` button, in the ` + colorstring.Green("'Your recently pushed branches:'") + ` section,
   which will bring you to the 'Open a pull request' page, where you can review and create your Pull Request.
	`
	fmt.Println(msg)
}
开发者ID:viktorbenei,项目名称:stepman,代码行数:15,代码来源:share_finish.go


示例2: InstallWithAptGetIfNeeded

// InstallWithAptGetIfNeeded ...
func InstallWithAptGetIfNeeded(tool string, isCIMode bool) error {
	if out, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("which", tool); err != nil {
		if err.Error() == "exit status 1" && out == "" {
			// Tool isn't installed -- install it...
			if !isCIMode {
				log.Infof("This step requires %s, which is not installed", tool)
				allow, err := goinp.AskForBool("Would you like to install (" + tool + ") with brew ? [yes/no]")
				if err != nil {
					return err
				}
				if !allow {
					return errors.New("(" + tool + ") is required for step")
				}
			}

			log.Infof("(%s) isn't installed, installing...", tool)
			if out, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("sudo", "apt-get", "-y", "install", tool); err != nil {
				log.Errorf("sudo apt-get -y install %s failed -- out: (%s) err: (%s)", tool, out, err)
				return err
			}

			log.Infof(" * "+colorstring.Green("[OK]")+" %s installed", tool)
		} else {
			// which failed
			log.Errorf("which (%s) failed -- out: (%s) err: (%s)", tool, out, err)
			return err
		}
	} else if out != "" {
		// already installed
	} else {
		log.Warnf("which (%s) -- out (%s)", tool, out)
	}

	return nil
}
开发者ID:viktorbenei,项目名称:bitrise,代码行数:36,代码来源:dependencies.go


示例3: pluginList

func pluginList(c *cli.Context) {
	pluginMap, err := plugins.ListPlugins()
	if err != nil {
		log.Fatalf("Failed to list plugins, err: %s", err)
	}

	pluginNames := []string{}
	for _, plugins := range pluginMap {
		for _, plugin := range plugins {
			pluginNames = append(pluginNames, plugin.PrintableName())
		}
	}
	sort.Strings(pluginNames)

	if len(pluginNames) > 0 {
		fmt.Println("")
		for _, name := range pluginNames {
			fmt.Printf(" ⚡️ %s\n", colorstring.Green(name))
		}
		fmt.Println("")
	} else {
		fmt.Println("")
		fmt.Println("No installed plugin found")
		fmt.Println("")
	}
}
开发者ID:birmacher,项目名称:bitrise,代码行数:26,代码来源:plugin_list.go


示例4: doSetupToolkits

func doSetupToolkits() error {
	log.Infoln("Checking Bitrise Toolkits...")

	coreToolkits := toolkits.AllSupportedToolkits()

	for _, aCoreTK := range coreToolkits {
		toolkitName := aCoreTK.ToolkitName()
		isInstallRequired, checkResult, err := aCoreTK.Check()
		if err != nil {
			return fmt.Errorf("Failed to perform toolkit check (%s), error: %s", toolkitName, err)
		}

		if isInstallRequired {
			log.Infoln("No installed/suitable '" + toolkitName + "' found, installing toolkit ...")
			if err := aCoreTK.Install(); err != nil {
				return fmt.Errorf("Failed to install toolkit (%s), error: %s", toolkitName, err)
			}

			isInstallRequired, checkResult, err = aCoreTK.Check()
			if err != nil {
				return fmt.Errorf("Failed to perform toolkit check (%s), error: %s", toolkitName, err)
			}
		}
		if isInstallRequired {
			return fmt.Errorf("Toolkit (%s) still reports that it isn't (properly) installed", toolkitName)
		}

		log.Infoln(" * "+colorstring.Green("[OK]")+" "+toolkitName+" :", checkResult.Path)
		log.Infoln("        version :", checkResult.Version)
	}

	return nil
}
开发者ID:bitrise-io,项目名称:bitrise,代码行数:33,代码来源:setup.go


示例5: printFinishCreate

func printFinishCreate(share ShareModel, stepDirInSteplib string, toolMode bool) {
	fmt.Println()
	log.Infof(" * "+colorstring.Green("[OK]")+" Your Step (%s) (%s) added to local StepLib (%s).", share.StepID, share.StepTag, stepDirInSteplib)
	log.Infoln(" *      You can find your Step's step.yml at: " + colorstring.Greenf("%s/step.yml", stepDirInSteplib))
	fmt.Println()
	fmt.Println("   " + GuideTextForShareFinish(toolMode))
}
开发者ID:bitrise-io,项目名称:stepman,代码行数:7,代码来源:share_create.go


示例6: checkIsBitriseToolInstalled

func checkIsBitriseToolInstalled(toolname, minVersion string, isInstall bool) error {
	doInstall := func() error {
		installCmdLines := []string{
			"curl -fL https://github.com/bitrise-io/" + toolname + "/releases/download/" + minVersion + "/" + toolname + "-$(uname -s)-$(uname -m) > /usr/local/bin/" + toolname,
			"chmod +x /usr/local/bin/" + toolname,
		}
		officialGithub := "https://github.com/bitrise-io/" + toolname
		fmt.Println()
		log.Warnln("No supported " + toolname + " version found.")
		log.Infoln("You can find more information about "+toolname+" on it's official GitHub page:", officialGithub)
		fmt.Println()

		// Install
		log.Infoln("Installing...")
		fmt.Println(strings.Join(installCmdLines, "\n"))
		if err := cmdex.RunBashCommandLines(installCmdLines); err != nil {
			return err
		}

		// check again
		return checkIsBitriseToolInstalled(toolname, minVersion, false)
	}

	// check whether installed
	progInstallPth, err := CheckProgramInstalledPath(toolname)
	if err != nil {
		if !isInstall {
			return err
		}

		return doInstall()
	}
	verStr, err := cmdex.RunCommandAndReturnStdout(toolname, "-version")
	if err != nil {
		log.Infoln("")
		return errors.New("Failed to get version")
	}

	// version check
	isVersionOk, err := versions.IsVersionGreaterOrEqual(verStr, minVersion)
	if err != nil {
		log.Error("Failed to validate installed version")
		return err
	}
	if !isVersionOk {
		log.Warn("Installed "+toolname+" found, but not a supported version: ", verStr)
		if !isInstall {
			return errors.New("Failed to install required version.")
		}
		log.Warn("Updating...")
		return doInstall()
	}

	log.Infoln(" * "+colorstring.Green("[OK]")+" "+toolname+" :", progInstallPth)
	log.Infoln("        version :", verStr)
	return nil
}
开发者ID:birmacher,项目名称:bitrise,代码行数:57,代码来源:dependencies.go


示例7: GuideTextForStart

// GuideTextForStart ...
func GuideTextForStart() string {
	guide := colorstring.Blue("Fork the StepLib repository") + " you want to share your Step in.\n" +
		`   You can find the main ("official") StepLib repository at: ` + colorstring.Green("https://github.com/bitrise-io/bitrise-steplib") + `

   ` + colorstring.Yellow("Note") + `: You can use any StepLib repository you like,
     the StepLib system is decentralized, you don't have to work with the main StepLib repository
     if you don't want to. Feel free to maintain and use your own (or your team's) Step Library.
`
	return guide
}
开发者ID:godrei,项目名称:stepman,代码行数:11,代码来源:share.go


示例8: InstallWithAptGetIfNeeded

// InstallWithAptGetIfNeeded ...
func InstallWithAptGetIfNeeded(aptGetDep stepmanModels.AptGetDepModel, isCIMode bool) error {
	isDepInstalled := false
	// First do a "which", to see if the binary is available.
	// Can be available from another source, not just from brew,
	// e.g. it's common to use NVM or similar to install and manage the Node.js version.
	{
		if out, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("which", aptGetDep.GetBinaryName()); err != nil {
			if err.Error() == "exit status 1" && out == "" {
				isDepInstalled = false
			} else {
				// unexpected `which` error
				return fmt.Errorf("which (%s) failed -- out: (%s) err: (%s)", aptGetDep.Name, out, err)
			}
		} else if out != "" {
			isDepInstalled = true
		} else {
			// no error but which's output was empty
			return fmt.Errorf("which (%s) failed -- no error (exit code 0) but output was empty", aptGetDep.Name)
		}
	}

	// then do a package manager specific lookup
	{
		if !isDepInstalled {
			// which did not find the binary, also check in brew,
			// whether the package is installed
			isDepInstalled = checkIfAptPackageInstalled(aptGetDep.Name)
		}
	}

	if !isDepInstalled {
		// Tool isn't installed -- install it...
		if !isCIMode {
			log.Infof(`This step requires "%s" to be available, but it is not installed.`, aptGetDep.GetBinaryName())
			allow, err := goinp.AskForBoolWithDefault(`Would you like to install the "`+aptGetDep.Name+`" package with apt-get?`, true)
			if err != nil {
				return err
			}
			if !allow {
				return errors.New("(" + aptGetDep.Name + ") is required for step")
			}
		}

		log.Infof("(%s) isn't installed, installing...", aptGetDep.Name)
		if cmdOut, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("sudo", "apt-get", "-y", "install", aptGetDep.Name); err != nil {
			log.Errorf("sudo apt-get -y install %s failed -- out: (%s) err: (%s)", aptGetDep.Name, cmdOut, err)
			return err
		}

		log.Infof(" * "+colorstring.Green("[OK]")+" %s installed", aptGetDep.Name)
	}

	return nil
}
开发者ID:bitrise-io,项目名称:bitrise,代码行数:55,代码来源:dependencies.go


示例9: share

func share(c *cli.Context) error {
	toolMode := c.Bool(ToolMode)

	guide := `
Do you want to ` + colorstring.Green("share ") + colorstring.Yellow("your ") + colorstring.Magenta("own ") + colorstring.Blue("Step") + ` with the world? Awesome!!
To get started you can find a template Step repository at: ` + colorstring.Green("https://github.com/bitrise-steplib/step-template") + `

Once you have your Step in a ` + colorstring.Yellow("public git repository") + ` you can share it with others.

To share your Step just follow these steps (pun intended ;) :

1. ` + GuideTextForStart() + `
2. ` + GuideTextForShareStart(toolMode) + `
3. ` + GuideTextForShareCreate(toolMode) + `
4. ` + GuideTextForAudit(toolMode) + `
5. ` + GuideTextForShareFinish(toolMode) + `
6. ` + GuideTextForFinish()
	fmt.Println(guide)

	return nil
}
开发者ID:godrei,项目名称:stepman,代码行数:21,代码来源:share.go


示例10: printRawEnvInfo

func printRawEnvInfo(env models.EnvInfoModel) {
	if env.DefaultValue != "" {
		fmt.Printf("- %s: %s\n", colorstring.Green(env.Key), env.DefaultValue)
	} else {
		fmt.Printf("- %s\n", colorstring.Green(env.Key))
	}

	fmt.Printf("  %s: %v\n", colorstring.Green("is expand"), env.IsExpand)

	if len(env.ValueOptions) > 0 {
		fmt.Printf("  %s:\n", colorstring.Green("value options"))
		for _, option := range env.ValueOptions {
			fmt.Printf("  - %s\n", option)
		}
	}

	if env.Description != "" {
		fmt.Printf("  %s:\n", colorstring.Green("description"))
		fmt.Printf("  %s\n", env.Description)
	}
}
开发者ID:godrei,项目名称:stepman,代码行数:21,代码来源:step_info.go


示例11: GuideTextForShareStart

// GuideTextForShareStart ...
func GuideTextForShareStart(toolMode bool) string {
	name := "stepman"
	if toolMode {
		name = "bitrise"
	}

	guide := "Call " + colorstring.Blue("'"+name+" share start -c STEPLIB_REPO_FORK_GIT_URL'") + ", with the " + colorstring.Yellow("git clone url") + " of " + colorstring.Yellow("your forked StepLib repository") + ".\n" +
		`   This will prepare your forked StepLib locally for sharing.

   For example, if you want to share your Step in the main StepLib repository you should call:
     ` + colorstring.Green(""+name+" share start -c https://github.com/[your-username]/bitrise-steplib.git") + `
	`
	return guide
}
开发者ID:godrei,项目名称:stepman,代码行数:15,代码来源:share.go


示例12: InstallWithBrewIfNeeded

// InstallWithBrewIfNeeded ...
func InstallWithBrewIfNeeded(brewDep stepmanModels.BrewDepModel, isCIMode bool) error {
	isDepInstalled := false
	// First do a "which", to see if the binary is available.
	// Can be available from another source, not just from brew,
	// e.g. it's common to use NVM or similar to install and manage the Node.js version.
	if out, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("which", brewDep.GetBinaryName()); err != nil {
		if err.Error() == "exit status 1" && out == "" {
			isDepInstalled = false
		} else {
			// unexpected `which` error
			return fmt.Errorf("which (%s) failed -- out: (%s) err: (%s)", brewDep.Name, out, err)
		}
	} else if out != "" {
		isDepInstalled = true
	} else {
		// no error but which's output was empty
		return fmt.Errorf("which (%s) failed -- no error (exit code 0) but output was empty", brewDep.Name)
	}

	if !isDepInstalled {
		// which did not find the binary, also check in brew,
		// whether the package is installed
		isDepInstalled = checkIfBrewPackageInstalled(brewDep.Name)
	}

	if !isDepInstalled {
		// Tool isn't installed -- install it...
		if !isCIMode {
			log.Infof("This step requires %s, which is not installed", brewDep.Name)
			allow, err := goinp.AskForBool("Would you like to install (" + brewDep.Name + ") with brew?")
			if err != nil {
				return err
			}
			if !allow {
				return errors.New("(" + brewDep.Name + ") is required for step")
			}
		}

		log.Infof("(%s) isn't installed, installing...", brewDep.Name)
		if out, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("brew", "install", brewDep.Name); err != nil {
			log.Errorf("brew install %s failed -- out: (%s) err: (%s)", brewDep.Name, out, err)
			return err
		}
		log.Infof(" * "+colorstring.Green("[OK]")+" %s installed", brewDep.Name)
	}

	return nil
}
开发者ID:godrei,项目名称:bitrise,代码行数:49,代码来源:dependencies.go


示例13: GuideTextForShareCreate

// GuideTextForShareCreate ...
func GuideTextForShareCreate(toolMode bool) string {
	name := "stepman"
	if toolMode {
		name = "bitrise"
	}

	guide := "Next, call " + colorstring.Blue("'"+name+" share create --tag STEP_VERSION_TAG --git STEP_GIT_URI --stepid STEP_ID'") + `,
   to add your Step to your forked StepLib repository (locally).

   This will copy the required step.yml file from your Step's repository.
   This is all what's required to add your step (or a new version) to a StepLib.

   ` + colorstring.Yellow("Important") + `: You have to add the (version) tag to your Step's repository before you would call this!
     You can do that at: https://github.com/[your-username]/[step-repository]/tags

   An example call:
     ` + colorstring.Green(""+name+" share create --tag 1.0.0 --git https://github.com/[your-username]/[step-repository].git --stepid my-awesome-step") + `

   ` + colorstring.Yellow("Note") + `: You'll still be able to modify the step.yml in the StepLib after this.
	`
	return guide
}
开发者ID:godrei,项目名称:stepman,代码行数:23,代码来源:share.go


示例14: PrintInstalledXcodeInfos

// PrintInstalledXcodeInfos ...
func PrintInstalledXcodeInfos() error {
	xcodeSelectPth, err := cmdex.RunCommandAndReturnStdout("xcode-select", "--print-path")
	if err != nil {
		xcodeSelectPth = "xcode-select --print-path failed to detect the location of activate Xcode Command Line Tools path"
	}

	progInstallPth, err := utils.CheckProgramInstalledPath("xcodebuild")
	if err != nil {
		return errors.New("xcodebuild is not installed")
	}

	isFullXcodeAvailable := false
	verStr, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("xcodebuild", "-version")
	if err != nil {
		// No full Xcode available, only the Command Line Tools
		// verStr is something like "xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance"
		isFullXcodeAvailable = false
	} else {
		// version OK - full Xcode available
		//  we'll just format it a bit to fit into one line
		isFullXcodeAvailable = true
		verStr = strings.Join(strings.Split(verStr, "\n"), " | ")
	}

	log.Infoln(" * "+colorstring.Green("[OK]")+" xcodebuild path :", progInstallPth)
	if !isFullXcodeAvailable {
		log.Infoln("        version (xcodebuild) :", colorstring.Yellowf("%s", verStr))
	} else {
		log.Infoln("        version (xcodebuild) :", verStr)
	}
	log.Infoln("        active Xcode (Command Line Tools) path (xcode-select --print-path) :", xcodeSelectPth)
	if !isFullXcodeAvailable {
		log.Warn(colorstring.Yellowf("%s", "No Xcode found, only the Xcode Command Line Tools are available!"))
		log.Warn(colorstring.Yellowf("%s", "Full Xcode is required to build, test and archive iOS apps!"))
	}

	return nil
}
开发者ID:godrei,项目名称:bitrise,代码行数:39,代码来源:dependencies.go


示例15: InstallWithBrewIfNeeded

// InstallWithBrewIfNeeded ...
func InstallWithBrewIfNeeded(tool string, isCIMode bool) error {
	if err := checkWithBrewProgramInstalled(tool); err != nil {
		if !isCIMode {
			log.Infof("This step requires %s, which is not installed", tool)
			allow, err := goinp.AskForBool("Would you like to install (" + tool + ") with brew ? [yes/no]")
			if err != nil {
				return err
			}
			if !allow {
				return errors.New("(" + tool + ") is required for step")
			}
		}

		log.Infof("(%s) isn't installed, installing...", tool)
		if out, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("brew", "install", tool); err != nil {
			log.Errorf("brew install %s failed -- out: (%s) err: (%s)", tool, out, err)
			return err
		}
		log.Infof(" * "+colorstring.Green("[OK]")+" %s installed", tool)
		return nil
	}
	return nil
}
开发者ID:viktorbenei,项目名称:bitrise,代码行数:24,代码来源:dependencies.go


示例16: CheckIsHomebrewInstalled

// CheckIsHomebrewInstalled ...
func CheckIsHomebrewInstalled(isFullSetupMode bool) error {
	brewRubyInstallCmdString := `$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
	officialSiteURL := "http://brew.sh/"

	progInstallPth, err := utils.CheckProgramInstalledPath("brew")
	if err != nil {
		fmt.Println()
		log.Warn("It seems that Homebrew is not installed on your system.")
		log.Infoln("Homebrew (short: brew) is required in order to be able to auto-install all the bitrise dependencies.")
		log.Infoln("You should be able to install brew by copying this command and running it in your Terminal:")
		log.Infoln(brewRubyInstallCmdString)
		log.Infoln("You can find more information about Homebrew on its official site at:", officialSiteURL)
		log.Warn("Once the installation of brew is finished you should call the bitrise setup again.")
		return err
	}
	verStr, err := cmdex.RunCommandAndReturnStdout("brew", "--version")
	if err != nil {
		log.Infoln("")
		return errors.New("Failed to get version")
	}

	if isFullSetupMode {
		// brew doctor
		doctorOutput, err := cmdex.RunCommandAndReturnCombinedStdoutAndStderr("brew", "doctor")
		if err != nil {
			fmt.Println("")
			log.Warn("brew doctor returned an error:")
			log.Warnf("%s", doctorOutput)
			return errors.New("Failed to: brew doctor")
		}
	}

	log.Infoln(" * "+colorstring.Green("[OK]")+" Homebrew :", progInstallPth)
	log.Infoln("        version :", verStr)
	return nil
}
开发者ID:godrei,项目名称:bitrise,代码行数:37,代码来源:dependencies.go


示例17: exportProvisioningProfiles

func exportProvisioningProfiles(provProfileFileInfos []provprofile.ProvisioningProfileFileInfoModel,
	exportTargetDirPath string) error {

	for idx, aProvProfileFileInfo := range provProfileFileInfos {
		if idx != 0 {
			fmt.Println()
		}
		provProfileInfo := aProvProfileFileInfo.ProvisioningProfileInfo
		log.Infoln("   "+colorstring.Green("Exporting Provisioning Profile:"), provProfileInfo.Name)
		log.Infoln("                      App ID Name:", provProfileInfo.AppIDName)
		log.Infoln("                           App ID:", provProfileInfo.Entitlements.AppID)
		log.Infoln("                  Expiration Date:", provProfileInfo.ExpirationDate)
		log.Infoln("                             UUID:", provProfileInfo.UUID)
		log.Infoln("                         TeamName:", provProfileInfo.TeamName)
		log.Infoln("                          Team ID:", provProfileInfo.Entitlements.TeamID)
		exportFileName := provProfileExportFileName(aProvProfileFileInfo)
		exportPth := filepath.Join(exportTargetDirPath, exportFileName)
		if err := cmdex.RunCommand("cp", aProvProfileFileInfo.Path, exportPth); err != nil {
			return fmt.Errorf("Failed to copy Provisioning Profile (from: %s) (to: %s), error: %s",
				aProvProfileFileInfo.Path, exportPth, err)
		}
	}
	return nil
}
开发者ID:bitrise-tools,项目名称:codesigndoc,代码行数:24,代码来源:common.go


示例18: Done

// Done ...
func Done(format string, v ...interface{}) {
	message := fmt.Sprintf(format, v...)
	fmt.Println(colorstring.Green(message))
}
开发者ID:bitrise-io,项目名称:steps-xcode-archive,代码行数:5,代码来源:log.go


示例19: initConfig

func initConfig(c *cli.Context) error {
	PrintBitriseHeaderASCIIArt(c.App.Version)

	bitriseConfigFileRelPath := "./" + DefaultBitriseConfigFileName
	bitriseSecretsFileRelPath := "./" + DefaultSecretsFileName

	if exists, err := pathutil.IsPathExists(bitriseConfigFileRelPath); err != nil {
		log.Fatalf("Failed to init path (%s), error: %s", bitriseConfigFileRelPath, err)
	} else if exists {
		ask := fmt.Sprintf("A config file already exists at %s - do you want to overwrite it?", bitriseConfigFileRelPath)
		if val, err := goinp.AskForBool(ask); err != nil {
			log.Fatalf("Failed to ask for input, error: %s", err)
		} else if !val {
			log.Info("Init canceled, existing file won't be overwritten.")
			os.Exit(0)
		}
	}

	userInputProjectTitle := ""
	userInputDevBranch := ""
	if val, err := goinp.AskForString("What's the BITRISE_APP_TITLE?"); err != nil {
		log.Fatalf("Failed to ask for input, error: %s", err)
	} else {
		userInputProjectTitle = val
	}
	if val, err := goinp.AskForString("What's your development branch's name?"); err != nil {
		log.Fatalf("Failed to ask for input, error: %s", err)
	} else {
		userInputDevBranch = val
	}

	bitriseConfContent, warnings, err := generateBitriseYMLContent(userInputProjectTitle, userInputDevBranch)
	for _, warning := range warnings {
		log.Warnf("warning: %s", warning)
	}
	if err != nil {
		log.Fatalf("Invalid Bitrise YML, error: %s", err)
	}

	if err := fileutil.WriteStringToFile(bitriseConfigFileRelPath, bitriseConfContent); err != nil {
		log.Fatalf("Failed to init the bitrise config file, error: %s", err)
	} else {
		fmt.Println()
		fmt.Println("# NOTES about the " + DefaultBitriseConfigFileName + " config file:")
		fmt.Println()
		fmt.Println("We initialized a " + DefaultBitriseConfigFileName + " config file for you.")
		fmt.Println("If you're in this folder you can use this config file")
		fmt.Println(" with bitrise automatically, you don't have to")
		fmt.Println(" specify it's path.")
		fmt.Println()
	}

	if initialized, err := saveSecretsToFile(bitriseSecretsFileRelPath, defaultSecretsContent); err != nil {
		log.Fatalf("Failed to init the secrets file, error: %s", err)
	} else if initialized {
		fmt.Println()
		fmt.Println("# NOTES about the " + DefaultSecretsFileName + " secrets file:")
		fmt.Println()
		fmt.Println("We also created a " + DefaultSecretsFileName + " file")
		fmt.Println(" in this directory, to keep your passwords, absolute path configurations")
		fmt.Println(" and other secrets separate from your")
		fmt.Println(" main configuration file.")
		fmt.Println("This way you can safely commit and share your configuration file")
		fmt.Println(" and ignore this secrets file, so nobody else will")
		fmt.Println(" know about your secrets.")
		fmt.Println(colorstring.Yellow("You should NEVER commit this secrets file into your repository!!"))
		fmt.Println()
	}

	// add the general .bitrise* item
	//  which will include both secret files like .bitrise.secrets.yml
	//  and the .bitrise work temp dir
	if err := addToGitignore(".bitrise*"); err != nil {
		log.Fatalf("Failed to add .gitignore pattern, error: %s", err)
	}
	fmt.Println(colorstring.Green("For your convenience we added the pattern '.bitrise*' to your .gitignore file"))
	fmt.Println(" to make it sure that no secrets or temporary work directories will be")
	fmt.Println(" committed into your repository.")

	fmt.Println()
	fmt.Println("Hurray, you're good to go!")
	fmt.Println("You can simply run:")
	fmt.Println("-> bitrise run test")
	fmt.Println("to test the sample configuration (which contains")
	fmt.Println("an example workflow called 'test').")
	fmt.Println()
	fmt.Println("Once you tested this sample setup you can")
	fmt.Println(" open the " + DefaultBitriseConfigFileName + " config file,")
	fmt.Println(" modify it and then run a workflow with:")
	fmt.Println("-> bitrise run YOUR-WORKFLOW-NAME")
	fmt.Println(" or trigger a build with a pattern:")
	fmt.Println("-> bitrise trigger YOUR/PATTERN")

	return nil
}
开发者ID:godrei,项目名称:bitrise,代码行数:95,代码来源:init.go


示例20: printFinishStart

func printFinishStart(specPth string, toolMode bool) {
	fmt.Println()
	log.Info(" * "+colorstring.Green("[OK]")+" You can find your StepLib repo at: ", specPth)
	fmt.Println()
	fmt.Println("   " + GuideTextForShareCreate(toolMode))
}
开发者ID:godrei,项目名称:stepman,代码行数:6,代码来源:share_start.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang colorstring.Yellow函数代码示例发布时间:2022-05-24
下一篇:
Golang colorstring.Blue函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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