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 }
func addColor(str string, color Color) string { return prettyprint.Colorize(fmt.Sprintf("%s%s%s", color.String(), str, Default.String())) }
func die(err error) { m := "{{.Red}}[BOO!]{{.Default}} " + err.Error() fmt.Println(pretty.Colorize(m)) os.Exit(1) }
func ftw(msg string, args ...interface{}) { t := fmt.Sprintf(msg, args...) m := "{{.Green}}[YAY!]{{.Default}} " + t fmt.Println(pretty.Colorize(m)) }
func info(msg string, args ...interface{}) { t := fmt.Sprintf(msg, args...) m := "{{.Yellow}}[INFO]{{.Default}} " + t fmt.Println(pretty.Colorize(m)) }
// Warn prints a yellow-tinted warning message. func Warn(format string, v ...interface{}) { fmt.Fprint(Stderr, pretty.Colorize("{{.Yellow}}[WARN]{{.Default}} ")) Msg(format, v...) }
// 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...) } }
// 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...) }
// 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...) }
// 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 }
// 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...) }
// 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...) } }