Пример #1
0
func printWarning(commits []*git.Commit) error {
	console, err := prompt.OpenConsole(os.O_WRONLY)
	if err != nil {
		return err
	}
	defer console.Close()

	fmt.Fprintln(console)
	hooks.PrintUnassignedWarning(console, commits)
	fmt.Fprintln(console)

	return nil
}
Пример #2
0
func promptUserForConfirmation(commits []*git.Commit) (bool, error) {
	// Open the console.
	console, err := prompt.OpenConsole(os.O_WRONLY)
	if err != nil {
		return false, err
	}
	defer console.Close()

	// Print the list of commits missing the Story-Id tag.
	fmt.Fprintln(console)
	hooks.PrintUnassignedWarning(console, commits)
	fmt.Fprintln(console)

	// Prompt the user for confirmation.
	defer fmt.Fprintln(console)
	return prompt.Confirm("Are you sure you want to push these commits?", false)
}
Пример #3
0
func printSalsaFlowEnabledTimestampWarning() (n int64, err error) {
	// Open the console to make sure the user can always see it.
	stdout, err := prompt.OpenConsole(os.O_WRONLY)
	if err != nil {
		return 0, err
	}
	defer stdout.Close()

	// Generate the warning.
	var output bytes.Buffer

	redBold := color.New(color.FgRed).Add(color.Bold).SprintFunc()
	fmt.Fprintln(&output, redBold("\nWarning: 'salsaflow_enabled_timestamp' key missing."))

	red := color.New(color.FgRed).SprintFunc()
	fmt.Fprintln(&output, red("Please set the key in the local configuration file."))
	fmt.Fprintln(&output, red("The format is: 2014-09-02T12:36:11.142902641+01:00\n"))

	// Dump it into the console.
	return io.Copy(ansicolor.NewAnsiColorWriter(stdout), &output)
}