2020-05-04 09:24:32 +02:00
|
|
|
package text
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
2020-05-08 18:13:51 +02:00
|
|
|
|
|
|
|
"github.com/leonelquinteros/gotext"
|
2020-05-04 09:24:32 +02:00
|
|
|
)
|
|
|
|
|
2020-07-06 02:02:12 +02:00
|
|
|
const (
|
|
|
|
arrow = "==>"
|
|
|
|
smallArrow = " ->"
|
|
|
|
opSymbol = "::"
|
|
|
|
)
|
2020-05-04 09:24:32 +02:00
|
|
|
|
|
|
|
func OperationInfoln(a ...interface{}) {
|
2020-07-10 02:36:45 +02:00
|
|
|
fmt.Fprint(os.Stdout, append([]interface{}{Bold(Cyan(opSymbol + " ")), boldCode}, a...)...)
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprintln(os.Stdout, ResetCode)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func OperationInfo(a ...interface{}) {
|
2020-07-10 02:36:45 +02:00
|
|
|
fmt.Fprint(os.Stdout, append([]interface{}{Bold(Cyan(opSymbol + " ")), boldCode}, a...)...)
|
|
|
|
fmt.Fprint(os.Stdout, ResetCode)
|
|
|
|
}
|
|
|
|
|
|
|
|
func SprintOperationInfo(a ...interface{}) string {
|
|
|
|
return fmt.Sprint(append([]interface{}{Bold(Cyan(opSymbol + " ")), boldCode}, a...)...) + ResetCode
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Info(a ...interface{}) {
|
2020-08-01 01:20:00 +02:00
|
|
|
fmt.Fprint(os.Stdout, append([]interface{}{Bold(Green(arrow + " "))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Infoln(a ...interface{}) {
|
2020-08-01 01:20:00 +02:00
|
|
|
fmt.Fprintln(os.Stdout, append([]interface{}{Bold(Green(arrow))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
2020-07-11 00:48:30 +02:00
|
|
|
func SprintWarn(a ...interface{}) string {
|
|
|
|
return fmt.Sprint(append([]interface{}{Bold(yellow(smallArrow + " "))}, a...)...)
|
|
|
|
}
|
|
|
|
|
2020-05-04 09:24:32 +02:00
|
|
|
func Warn(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprint(os.Stdout, append([]interface{}{Bold(yellow(smallArrow + " "))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Warnln(a ...interface{}) {
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprintln(os.Stdout, append([]interface{}{Bold(yellow(smallArrow))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
2020-07-10 02:36:45 +02:00
|
|
|
func SprintError(a ...interface{}) string {
|
|
|
|
return fmt.Sprint(append([]interface{}{Bold(Red(smallArrow + " "))}, a...)...)
|
|
|
|
}
|
|
|
|
|
2020-05-04 09:24:32 +02:00
|
|
|
func Error(a ...interface{}) {
|
2020-07-10 02:36:45 +02:00
|
|
|
fmt.Fprint(os.Stderr, append([]interface{}{Bold(Red(smallArrow + " "))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Errorln(a ...interface{}) {
|
2020-07-10 02:36:45 +02:00
|
|
|
fmt.Fprintln(os.Stderr, append([]interface{}{Bold(Red(smallArrow))}, a...)...)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func PrintInfoValue(str, value string) {
|
|
|
|
if value == "" {
|
2020-05-08 18:13:51 +02:00
|
|
|
value = gotext.Get("None")
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|
|
|
|
|
2020-07-05 02:01:08 +02:00
|
|
|
fmt.Fprintf(os.Stdout, Bold("%-16s%s")+" %s\n", str, ":", value)
|
2020-05-04 09:24:32 +02:00
|
|
|
}
|