Beispiel #1
0
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
}
Beispiel #2
0
Datei: log.go Projekt: deis/pkg
func addColor(str string, color Color) string {
	return prettyprint.Colorize(fmt.Sprintf("%s%s%s", color.String(), str, Default.String()))
}
Beispiel #3
0
func die(err error) {
	m := "{{.Red}}[BOO!]{{.Default}} " + err.Error()
	fmt.Println(pretty.Colorize(m))
	os.Exit(1)
}
Beispiel #4
0
func ftw(msg string, args ...interface{}) {
	t := fmt.Sprintf(msg, args...)
	m := "{{.Green}}[YAY!]{{.Default}} " + t
	fmt.Println(pretty.Colorize(m))
}
Beispiel #5
0
func info(msg string, args ...interface{}) {
	t := fmt.Sprintf(msg, args...)
	m := "{{.Yellow}}[INFO]{{.Default}} " + t
	fmt.Println(pretty.Colorize(m))
}
Beispiel #6
0
// Warn prints a yellow-tinted warning message.
func Warn(format string, v ...interface{}) {
	fmt.Fprint(Stderr, pretty.Colorize("{{.Yellow}}[WARN]{{.Default}} "))
	Msg(format, v...)
}
Beispiel #7
0
// 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...)
	}
}
Beispiel #8
0
// 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...)
}
Beispiel #9
0
// 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...)
}
Beispiel #10
0
// 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
}
Beispiel #11
0
// 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...)
}
Beispiel #12
0
// 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...)
	}
}