yay/pkg/text/print.go

55 lines
1.3 KiB
Go
Raw Normal View History

package text
import (
"fmt"
"os"
2020-05-08 18:13:51 +02:00
"github.com/leonelquinteros/gotext"
)
const arrow = "==>"
const smallArrow = " ->"
const opSymbol = ":: "
func OperationInfoln(a ...interface{}) {
fmt.Fprint(os.Stdout, append([]interface{}{boldCode, cyan(opSymbol), boldCode}, a...)...)
fmt.Fprintln(os.Stdout, resetCode)
}
func OperationInfo(a ...interface{}) {
fmt.Fprint(os.Stdout, append([]interface{}{boldCode, cyan(opSymbol), boldCode}, a...)...)
fmt.Fprint(os.Stdout, resetCode+" ")
}
func Info(a ...interface{}) {
fmt.Fprint(os.Stdout, append([]interface{}{bold(green(arrow + " "))}, a...)...)
}
func Infoln(a ...interface{}) {
fmt.Fprintln(os.Stdout, append([]interface{}{bold(green(arrow))}, a...)...)
}
func Warn(a ...interface{}) {
2020-05-08 18:13:51 +02:00
fmt.Fprint(os.Stdout, append([]interface{}{bold(yellow(smallArrow + " "))}, a...)...)
}
func Warnln(a ...interface{}) {
fmt.Fprintln(os.Stdout, append([]interface{}{bold(yellow(smallArrow))}, a...)...)
}
func Error(a ...interface{}) {
2020-05-08 18:13:51 +02:00
fmt.Fprint(os.Stderr, append([]interface{}{bold(red(smallArrow + " "))}, a...)...)
}
func Errorln(a ...interface{}) {
fmt.Fprintln(os.Stderr, append([]interface{}{bold(red(smallArrow))}, a...)...)
}
func PrintInfoValue(str, value string) {
if value == "" {
2020-05-08 18:13:51 +02:00
value = gotext.Get("None")
}
2020-05-30 00:43:18 +02:00
fmt.Fprintf(os.Stdout, bold("%-16s%s")+" %s\n", str, ":", value)
}