git-pre-commit-hook/output.go

29 lines
609 B
Go

package main
import (
"fmt"
"os"
"github.com/logrusorgru/aurora"
)
var (
title = aurora.Blue("[~/git/hooks/bin/pre-commit]")
info = aurora.Blue("INFO")
warning = aurora.Yellow("WARN")
errorStr = aurora.Red("ERR ")
)
func Info(format string, args ...interface{}) {
fmt.Fprintln(os.Stderr, title, info, fmt.Sprintf(format, args...))
}
func Warn(format string, args ...interface{}) {
fmt.Fprintln(os.Stderr, title, warning, fmt.Sprintf(format, args...))
}
func Err(format string, args ...interface{}) {
fmt.Fprintln(os.Stderr, title, errorStr, fmt.Sprintf(format, args...))
os.Exit(1)
}